def rescan_template path
return unless path.match KNOWN_TEMPLATE_EXTENSIONS and @app_tree.path_exists?(path)
template_name = template_path_to_name(path)
tracker.reset_template template_name
fp = Brakeman::FileParser.new(tracker, @app_tree)
template_parser = Brakeman::TemplateParser.new(tracker, fp)
template_parser.parse_template path, @app_tree.read_path(path)
process_template fp.file_list[:templates].first
@processor.process_template_alias tracker.templates[template_name]
rescan = Set.new
tracker.templates.each do |_name, template|
if template.file == path or template.file.nil?
next unless template.render_path and template.name.to_sym == template_name.to_sym
template.render_path.each do |from|
case from[:type]
when :template
rescan << [:template, from[:name]]
when :controller
rescan << [:controller, from[:class], from[:method]]
end
end
end
end
rescan.each do |r|
if r[0] == :controller
controller = tracker.controllers[r[1]]
controller.src.each do |file, src|
unless @paths.include? file
@processor.process_controller_alias controller.name, src, r[2], file
end
end
elsif r[0] == :template
template = tracker.templates[r[1]]
rescan_template template.file
end
end
@reindex << :templates
end