Class: Brakeman::Report::Tabs

Inherits:
Table show all
Defined in:
lib/brakeman/report/report_tabs.rb

Overview

Generated tab-separated output suitable for the Jenkins Brakeman Plugin: github.com/presidentbeef/brakeman-jenkins-plugin

Constant Summary

Constants included from Util

Util::ALL_COOKIES, Util::ALL_PARAMETERS, Util::COOKIES, Util::COOKIES_SEXP, Util::DIR_CONST, Util::LITERALS, Util::PARAMETERS, Util::PARAMS_SEXP, Util::PATH_PARAMETERS, Util::QUERY_PARAMETERS, Util::REQUEST_COOKIES, Util::REQUEST_ENV, Util::REQUEST_PARAMETERS, Util::REQUEST_PARAMS, Util::REQUEST_REQUEST_PARAMETERS, Util::SAFE_LITERAL, Util::SESSION, Util::SESSION_SEXP, Util::SIMPLE_LITERALS

Instance Attribute Summary

Attributes inherited from Base

#checks, #tracker

Instance Method Summary collapse

Methods inherited from Table

#convert_ignored_warning, #convert_template_warning, #convert_to_rows, #convert_warning, #generate_controller_warnings, #generate_controllers, #generate_errors, #generate_ignored_warnings, #generate_model_warnings, #generate_obsolete, #generate_overview, #generate_template_warnings, #generate_templates, #generate_warning_overview, #generate_warnings, #initialize, #output_table, #render_array, #render_warnings, #sort, #text_header, #text_message, #truncate_table

Methods inherited from Base

#absolute_paths?, #all_warnings, #context_for, #controller_information, #controller_warnings, #filter_warnings, #generic_warnings, #github_url, #ignored_warnings, #initialize, #model_warnings, #number_of_templates, #rails_version, #template_warnings, #warning_file, #warnings_summary

Methods included from Util

#all_literals?, #array?, #block?, #call?, #camelize, #class_name, #constant?, #contains_class?, #cookies?, #dir_glob?, #false?, #hash?, #hash_access, #hash_insert, #hash_iterate, #hash_values, #integer?, #kwsplat?, #literal?, #make_call, #node_type?, #number?, #params?, #pluralize, #rails_version, #recurse_check?, #regexp?, #remove_kwsplat, #request_headers?, #request_value?, #result?, #safe_literal, #safe_literal?, #safe_literal_target?, #set_env_defaults, #sexp?, #simple_literal?, #string?, #string_interp?, #symbol?, #template_path_to_name, #true?, #underscore

Constructor Details

This class inherits a constructor from Brakeman::Report::Table

Instance Method Details

#generate_reportObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/brakeman/report/report_tabs.rb', line 6

def generate_report
  [[:generic_warnings, "General"], [:controller_warnings, "Controller"],
    [:model_warnings, "Model"], [:template_warnings, "Template"]].map do |meth, category|

    self.send(meth).map do |w|
      line = w.line || 0
      w.warning_type.gsub!(/[^\w\s]/, ' ')
      "#{(w.file.absolute)}\t#{line}\t#{w.warning_type}\t#{category}\t#{w.format_message}\t#{w.confidence_name}"
    end.join "\n"

  end.join "\n"

end