class Brakeman::Report
Generates a report based on the Tracker and the results of Tracker#run_checks. Be sure to run_checks
before generating a report.
Constants
- VALID_FORMATS
Attributes
tracker[R]
Public Class Methods
new(tracker)
click to toggle source
# File lib/brakeman/report.rb, line 11 def initialize tracker @app_tree = tracker.app_tree @tracker = tracker end
Public Instance Methods
format(format)
click to toggle source
# File lib/brakeman/report.rb, line 16 def format format reporter = case format when :to_codeclimate require_report 'codeclimate' Brakeman::Report::CodeClimate when :to_csv require_report 'csv' Brakeman::Report::CSV when :to_html require_report 'html' Brakeman::Report::HTML when :to_json return self.to_json when :to_tabs require_report 'tabs' Brakeman::Report::Tabs when :to_hash require_report 'hash' Brakeman::Report::Hash when :to_markdown return self.to_markdown when :to_plain, :to_text, :to_s return self.to_plain when :to_table return self.to_table when :to_pdf raise "PDF output is not yet supported." when :to_junit require_report 'junit' Brakeman::Report::JUnit when :to_sarif return self.to_sarif when :to_sonar require_report 'sonar' Brakeman::Report::Sonar when :to_github require_report 'github' Brakeman::Report::Github else raise "Invalid format: #{format}. Should be one of #{VALID_FORMATS.inspect}" end generate(reporter) end
generate(reporter)
click to toggle source
# File lib/brakeman/report.rb, line 106 def generate reporter reporter.new(@tracker).generate_report end
method_missing(method, *args)
click to toggle source
Calls superclass method
# File lib/brakeman/report.rb, line 61 def method_missing method, *args if VALID_FORMATS.include? method format method else super end end
require_report(type)
click to toggle source
# File lib/brakeman/report.rb, line 69 def require_report type require "brakeman/report/report_#{type}" end
to_json()
click to toggle source
# File lib/brakeman/report.rb, line 73 def to_json require_report 'json' generate Brakeman::Report::JSON end
to_markdown()
click to toggle source
# File lib/brakeman/report.rb, line 88 def to_markdown require_report 'markdown' generate Brakeman::Report::Markdown end
to_sarif()
click to toggle source
# File lib/brakeman/report.rb, line 101 def to_sarif require_report 'sarif' generate Brakeman::Report::SARIF end
to_sonar()
click to toggle source
# File lib/brakeman/report.rb, line 78 def to_sonar require_report 'sonar' generate Brakeman::Report::Sonar end
to_table()
click to toggle source
# File lib/brakeman/report.rb, line 83 def to_table require_report 'table' generate Brakeman::Report::Table end