def reindex_call_sites locations
if locations.length == 3
return index_call_sites
end
if locations.include? :templates
@call_index.remove_template_indexes
end
classes_to_reindex = Set.new
method_sets = []
if locations.include? :models
classes_to_reindex.merge self.models.keys
method_sets << self.models
end
if locations.include? :controllers
classes_to_reindex.merge self.controllers.keys
method_sets << self.controllers
end
@call_index.remove_indexes_by_class classes_to_reindex
finder = Brakeman::FindAllCalls.new self
method_sets.each do |set|
set.each do |set_name, info|
info.each_method do |method_name, definition|
src = definition[:src]
finder.process_source src, :class => set_name, :method => method_name, :file => definition[:file]
end
end
end
if locations.include? :templates
self.each_template do |_name, template|
finder.process_source template.src, :template => template, :file => template.file
end
end
@call_index.index_calls finder.calls
end