mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Add UselessAssign#exclude_type_declarations
This commit is contained in:
parent
aeffa6ad00
commit
5a24f1eba5
2 changed files with 25 additions and 0 deletions
|
@ -3,6 +3,7 @@ require "../../../spec_helper"
|
|||
module Ameba::Rule::Lint
|
||||
describe UselessAssign do
|
||||
subject = UselessAssign.new
|
||||
.tap(&.exclude_type_declarations = false)
|
||||
|
||||
it "does not report used assignments" do
|
||||
expect_no_issues subject, <<-CRYSTAL
|
||||
|
@ -1007,6 +1008,27 @@ module Ameba::Rule::Lint
|
|||
end
|
||||
end
|
||||
|
||||
context "#properties" do
|
||||
context "#exclude_type_declarations" do
|
||||
it "doesn't report type declarations if enabled" do
|
||||
rule = UselessAssign.new
|
||||
rule.exclude_type_declarations = true
|
||||
|
||||
expect_no_issues rule, <<-CRYSTAL
|
||||
a : String?
|
||||
|
||||
class Foo
|
||||
b : String?
|
||||
end
|
||||
|
||||
def foo
|
||||
c : String?
|
||||
end
|
||||
CRYSTAL
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "uninitialized" do
|
||||
it "reports if uninitialized assignment is not referenced at a top level" do
|
||||
expect_issue subject, <<-CRYSTAL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue