diff --git a/lib/quiet_quality/tools/brakeman/parser.rb b/lib/quiet_quality/tools/brakeman/parser.rb index 870d923..24755fa 100644 --- a/lib/quiet_quality/tools/brakeman/parser.rb +++ b/lib/quiet_quality/tools/brakeman/parser.rb @@ -2,6 +2,8 @@ module QuietQuality module Tools module Brakeman class Parser + include Logging + def initialize(text) @text = text end @@ -24,6 +26,8 @@ def data def check_errors! errors = data[:errors] return if errors.nil? || errors.empty? + warn "Brakeman errors:" + errors.each { |error| warn " #{error}" } fail(ParsingError, "Found #{errors.length} errors in brakeman output") end diff --git a/spec/quiet_quality/tools/brakeman/parser_spec.rb b/spec/quiet_quality/tools/brakeman/parser_spec.rb index c2c4755..1df03a4 100644 --- a/spec/quiet_quality/tools/brakeman/parser_spec.rb +++ b/spec/quiet_quality/tools/brakeman/parser_spec.rb @@ -40,11 +40,14 @@ context "when there are errors" do let(:text) { fixture_content("tools", "brakeman", "errors.json") } - it "raises a ParsingError" do + it "raises a ParsingError and logs the errors" do expect { messages }.to raise_error( QuietQuality::Tools::ParsingError, /Found 2 errors/ ) + expect_warn "Brakeman errors:" + expect_warn " Something went wrong" + expect_warn " Something else too" end end end