mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Add rule's name to flycheck formatter
This commit is contained in:
parent
69cff77970
commit
2382657e15
2 changed files with 8 additions and 4 deletions
|
@ -21,7 +21,9 @@ module Ameba::Formatter
|
||||||
s.error DummyRule.new, 1, 2, "message"
|
s.error DummyRule.new, 1, 2, "message"
|
||||||
subject = flycheck
|
subject = flycheck
|
||||||
subject.source_finished s
|
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
|
end
|
||||||
|
|
||||||
it "properly reports multi-line message" do
|
it "properly reports multi-line message" do
|
||||||
|
@ -29,7 +31,9 @@ module Ameba::Formatter
|
||||||
s.error DummyRule.new, 1, 2, "multi\nline"
|
s.error DummyRule.new, 1, 2, "multi\nline"
|
||||||
subject = flycheck
|
subject = flycheck
|
||||||
subject.source_finished s
|
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
|
end
|
||||||
|
|
||||||
it "reports nothing if location was not set" do
|
it "reports nothing if location was not set" do
|
||||||
|
|
|
@ -4,9 +4,9 @@ module Ameba::Formatter
|
||||||
source.errors.each do |e|
|
source.errors.each do |e|
|
||||||
next if e.disabled?
|
next if e.disabled?
|
||||||
if loc = e.location
|
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",
|
source.path, loc.line_number, loc.column_number, "E",
|
||||||
e.message.gsub("\n", " ")
|
e.rule.name, e.message.gsub("\n", " ")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue