mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Detect shadowing outer local vars
This commit is contained in:
parent
3887da1438
commit
15bb8f5331
6 changed files with 216 additions and 14 deletions
|
@ -15,9 +15,9 @@ module Ameba::Formatter
|
|||
Colorize.enabled = false
|
||||
|
||||
path = "source.cr"
|
||||
s = Source.new("", path).tap do |s|
|
||||
s.error(ErrorRule.new, 1, 2, "ErrorRule", :disabled)
|
||||
s.error(NamedRule.new, 2, 2, "NamedRule", :disabled)
|
||||
s = Source.new("", path).tap do |source|
|
||||
source.error(ErrorRule.new, 1, 2, "ErrorRule", :disabled)
|
||||
source.error(NamedRule.new, 2, 2, "NamedRule", :disabled)
|
||||
end
|
||||
subject.finished [s]
|
||||
log = output.to_s
|
||||
|
@ -29,9 +29,9 @@ module Ameba::Formatter
|
|||
end
|
||||
|
||||
it "does not write not-disabled rules" do
|
||||
s = Source.new("", "source.cr").tap do |s|
|
||||
s.error(ErrorRule.new, 1, 2, "ErrorRule")
|
||||
s.error(NamedRule.new, 2, 2, "NamedRule", :disabled)
|
||||
s = Source.new("", "source.cr").tap do |source|
|
||||
source.error(ErrorRule.new, 1, 2, "ErrorRule")
|
||||
source.error(NamedRule.new, 2, 2, "NamedRule", :disabled)
|
||||
end
|
||||
subject.finished [s]
|
||||
output.to_s.should_not contain ErrorRule.name
|
||||
|
|
|
@ -39,9 +39,9 @@ module Ameba::Formatter
|
|||
|
||||
context "when errors found" do
|
||||
it "writes each error" do
|
||||
s = Source.new("").tap do |s|
|
||||
s.error(DummyRule.new, 1, 1, "DummyRuleError")
|
||||
s.error(NamedRule.new, 1, 2, "NamedRuleError")
|
||||
s = Source.new("").tap do |source|
|
||||
source.error(DummyRule.new, 1, 1, "DummyRuleError")
|
||||
source.error(NamedRule.new, 1, 2, "NamedRuleError")
|
||||
end
|
||||
subject.finished [s]
|
||||
log = output.to_s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue