From 3d21512772edd3e8366241b57b1a9386d70bdc46 Mon Sep 17 00:00:00 2001 From: Justin Collins Date: Thu, 25 Jul 2013 13:48:06 -0700 Subject: [PATCH] Also ignore warnings in tabs output --- lib/brakeman/report/report_tabs.rb | 4 ++-- test/tests/tabs_output.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 test/tests/tabs_output.rb diff --git a/lib/brakeman/report/report_tabs.rb b/lib/brakeman/report/report_tabs.rb index 9e86793a..2347f5ac 100644 --- a/lib/brakeman/report/report_tabs.rb +++ b/lib/brakeman/report/report_tabs.rb @@ -2,10 +2,10 @@ #https://github.com/presidentbeef/brakeman-jenkins-plugin class Brakeman::Report::Tabs < Brakeman::Report::Base def generate_report - [[:warnings, "General"], [:controller_warnings, "Controller"], + [[:generic_warnings, "General"], [:controller_warnings, "Controller"], [:model_warnings, "Model"], [:template_warnings, "Template"]].map do |meth, category| - checks.send(meth).map do |w| + self.send(meth).map do |w| line = w.line || 0 w.warning_type.gsub!(/[^\w\s]/, ' ') "#{warning_file(w, :absolute)}\t#{line}\t#{w.warning_type}\t#{category}\t#{w.format_message}\t#{TEXT_CONFIDENCE[w.confidence]}" diff --git a/test/tests/tabs_output.rb b/test/tests/tabs_output.rb new file mode 100644 index 00000000..dfbef704 --- /dev/null +++ b/test/tests/tabs_output.rb @@ -0,0 +1,11 @@ +class TestTabsOutput < Test::Unit::TestCase + Report = Brakeman.run(:app_path => "#{TEST_PATH}/apps/rails2", :quiet => true).report.to_tabs + + def test_reported_warnings + if Brakeman::Scanner::RUBY_1_9 + assert_equal Report.lines.to_a.count, 96 + else + assert_equal Report.lines.to_a.count, 97 + end + end +end -- GitLab