提交 b2ff5d26 编写于 作者: J Justin Collins

Use options for FindAllCalls#process_source

上级 4f0a4d74
......@@ -166,7 +166,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
if block.node_type == :block
find_calls = Brakeman::FindAllCalls.new tracker
find_calls.process_source block, model_name, scope_name
find_calls.process_source block, :class => model_name, :method => scope_name
find_calls.calls.each do |call|
if @sql_targets.include? call[:method]
......
......@@ -13,10 +13,11 @@ class Brakeman::FindAllCalls < Brakeman::BaseProcessor
#Process the given source. Provide either class and method being searched
#or the template. These names are used when reporting results.
def process_source exp, klass = nil, method = nil, template = nil
@current_class = klass
@current_method = method
@current_template = template
def process_source exp, opts
@current_class = opts[:class]
@current_method = opts[:method]
@current_template = opts[:template]
@current_file = opts[:file]
process exp
end
......
......@@ -86,7 +86,7 @@ class Brakeman::Tracker
method_name = "#{definition[1]}.#{method_name}"
end
yield definition, set_name, method_name
yield definition, set_name, method_name, info[:file]
end
end
......@@ -155,12 +155,12 @@ class Brakeman::Tracker
def index_call_sites
finder = Brakeman::FindAllCalls.new self
self.each_method do |definition, set_name, method_name|
finder.process_source definition, set_name, method_name
self.each_method do |definition, set_name, method_name, file|
finder.process_source definition, :class => set_name, :method => method_name, :file => file
end
self.each_template do |name, template|
finder.process_source template[:src], nil, nil, template
finder.process_source template[:src], :template => template, :file => template[:file]
end
@call_index = Brakeman::CallIndex.new finder.calls
......@@ -208,7 +208,7 @@ class Brakeman::Tracker
method_name = "#{definition[1]}.#{method_name}"
end
finder.process_source definition, set_name, method_name
finder.process_source definition, :class => set_name, :method => method_name, :file => info[:file]
end
end
......@@ -217,7 +217,7 @@ class Brakeman::Tracker
if locations.include? :templates
self.each_template do |name, template|
finder.process_source template[:src], nil, nil, template
finder.process_source template[:src], :template => template, :file => template[:file]
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册