# File lib/brakeman/util.rb, line 364
  def file_by_name name, type, tracker = nil
    return nil unless name
    string_name = name.to_s
    name = name.to_sym

    unless type
      if string_name =~ /Controller$/
        type = :controller
      elsif camelize(string_name) == string_name # This is not always true
        type = :model
      else
        type = :template
      end
    end

    path = tracker.app_path

    case type
    when :controller
      if tracker.controllers[name]
        path = tracker.controllers[name].file
      else
        path += "/app/controllers/#{underscore(string_name)}.rb"
      end
    when :model
      if tracker.models[name]
        path = tracker.models[name].file
      else
        path += "/app/models/#{underscore(string_name)}.rb"
      end
    when :template
      if tracker.templates[name] and tracker.templates[name].file
        path = tracker.templates[name].file
      elsif string_name.include? " "
        name = string_name.split[0].to_sym
        path = file_for tracker, name, :template
      else
        path = nil
      end
    end

    path
  end