Avoid duplicated sections in a generated TODO file (additional fix)

This commit is contained in:
Vitalii Elenhaupt 2019-10-27 22:56:53 +02:00
parent 111596541b
commit 4ae0195628
No known key found for this signature in database
GPG Key ID: CD0BF17825928BC0
3 changed files with 7 additions and 3 deletions

View File

@ -82,6 +82,7 @@ module Ameba
s1 = Source.new "a = 1", "source1.cr"
s2 = Source.new "a = 1", "source2.cr"
s1.add_issue DummyRule.new, {1, 2}, "message1"
s1.add_issue NamedRule.new, {1, 2}, "message1"
s1.add_issue DummyRule.new, {2, 2}, "message1"
s2.add_issue DummyRule.new, {2, 2}, "message2"

View File

@ -41,8 +41,7 @@ module Ameba::Formatter
Hash(Rule::Base, Array(Issue)).new.tap do |h|
issues.each do |issue|
next if issue.disabled? || issue.rule.is_a? Rule::Lint::Syntax
h[issue.rule] ||= Array(Issue).new
h[issue.rule] << issue
(h[issue.rule] ||= Array(Issue).new) << issue
end
end
end

View File

@ -106,7 +106,11 @@ module Ameba::Rule
end
def ==(other)
self.name == other.name
name == other.try &.name
end
def hash
name.hash
end
macro issue_for(*args)