Do not report if disabled rules exist

closes #101
This commit is contained in:
Vitalii Elenhaupt 2019-04-25 08:47:37 +03:00
parent 4000ac7d4d
commit af395a3c13
No known key found for this signature in database
GPG key ID: 7558EF3A4056C706
2 changed files with 18 additions and 1 deletions

View file

@ -150,6 +150,21 @@ module Ameba
Runner.new(rules, [s], formatter, Severity::Warning).run.success?.should be_true
Runner.new(rules, [s], formatter, Severity::Refactoring).run.success?.should be_false
end
it "returns false if issue is disabled" do
rules = [NamedRule.new] of Rule::Base
source = Source.new %(
def foo
bar = 1 # ameba:disable #{NamedRule.name}
end
)
source.add_issue NamedRule.new, location: {2, 1},
message: "Useless assignment"
Runner
.new(rules, [source], formatter, default_severity)
.run.success?.should be_true
end
end
end
end

View file

@ -112,7 +112,9 @@ module Ameba
#
def success?
@sources.all? do |source|
source.issues.none? { |issue| issue.rule.severity <= @severity }
source.issues
.reject(&.disabled?)
.none? { |issue| issue.rule.severity <= @severity }
end
end