diff --git a/spec/ameba/formatter/flycheck_formatter_spec.cr b/spec/ameba/formatter/flycheck_formatter_spec.cr index 11a5d7e6..2b4785ce 100644 --- a/spec/ameba/formatter/flycheck_formatter_spec.cr +++ b/spec/ameba/formatter/flycheck_formatter_spec.cr @@ -21,7 +21,9 @@ module Ameba::Formatter s.error DummyRule.new, 1, 2, "message" subject = flycheck subject.source_finished s - subject.output.to_s.should eq "source.cr:1:2: E: message\n" + subject.output.to_s.should eq( + "source.cr:1:2: E: [#{DummyRule.name}] message\n" + ) end it "properly reports multi-line message" do @@ -29,7 +31,9 @@ module Ameba::Formatter s.error DummyRule.new, 1, 2, "multi\nline" subject = flycheck subject.source_finished s - subject.output.to_s.should eq "source.cr:1:2: E: multi line\n" + subject.output.to_s.should eq( + "source.cr:1:2: E: [#{DummyRule.name}] multi line\n" + ) end it "reports nothing if location was not set" do diff --git a/src/ameba/formatter/flycheck_formatter.cr b/src/ameba/formatter/flycheck_formatter.cr index 09ae8b8d..21e96547 100644 --- a/src/ameba/formatter/flycheck_formatter.cr +++ b/src/ameba/formatter/flycheck_formatter.cr @@ -4,9 +4,9 @@ module Ameba::Formatter source.errors.each do |e| next if e.disabled? if loc = e.location - output.printf "%s:%d:%d: %s: %s\n", + output.printf "%s:%d:%d: %s: [%s] %s\n", source.path, loc.line_number, loc.column_number, "E", - e.message.gsub("\n", " ") + e.rule.name, e.message.gsub("\n", " ") end end end