mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Avoid duplicated sections in a generated TODO file (additional fix)
This commit is contained in:
parent
111596541b
commit
4ae0195628
3 changed files with 7 additions and 3 deletions
|
@ -82,6 +82,7 @@ module Ameba
|
||||||
s1 = Source.new "a = 1", "source1.cr"
|
s1 = Source.new "a = 1", "source1.cr"
|
||||||
s2 = Source.new "a = 1", "source2.cr"
|
s2 = Source.new "a = 1", "source2.cr"
|
||||||
s1.add_issue DummyRule.new, {1, 2}, "message1"
|
s1.add_issue DummyRule.new, {1, 2}, "message1"
|
||||||
|
s1.add_issue NamedRule.new, {1, 2}, "message1"
|
||||||
s1.add_issue DummyRule.new, {2, 2}, "message1"
|
s1.add_issue DummyRule.new, {2, 2}, "message1"
|
||||||
s2.add_issue DummyRule.new, {2, 2}, "message2"
|
s2.add_issue DummyRule.new, {2, 2}, "message2"
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@ module Ameba::Formatter
|
||||||
Hash(Rule::Base, Array(Issue)).new.tap do |h|
|
Hash(Rule::Base, Array(Issue)).new.tap do |h|
|
||||||
issues.each do |issue|
|
issues.each do |issue|
|
||||||
next if issue.disabled? || issue.rule.is_a? Rule::Lint::Syntax
|
next if issue.disabled? || issue.rule.is_a? Rule::Lint::Syntax
|
||||||
h[issue.rule] ||= Array(Issue).new
|
(h[issue.rule] ||= Array(Issue).new) << issue
|
||||||
h[issue.rule] << issue
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -106,7 +106,11 @@ module Ameba::Rule
|
||||||
end
|
end
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
self.name == other.name
|
name == other.try &.name
|
||||||
|
end
|
||||||
|
|
||||||
|
def hash
|
||||||
|
name.hash
|
||||||
end
|
end
|
||||||
|
|
||||||
macro issue_for(*args)
|
macro issue_for(*args)
|
||||||
|
|
Loading…
Reference in a new issue