mirror of
https://gitea.invidious.io/iv-org/shard-ameba.git
synced 2024-08-15 00:53:29 +00:00
Skip lib definitions altogether
This commit is contained in:
parent
d23ad7f0ab
commit
98d5bc720a
2 changed files with 12 additions and 0 deletions
|
@ -998,6 +998,16 @@ module Ameba::Rule::Lint
|
|||
CRYSTAL
|
||||
end
|
||||
|
||||
it "doesn't report if it's referenced in a lib" do
|
||||
expect_no_issues subject, <<-CRYSTAL
|
||||
lib LibFoo
|
||||
struct Foo
|
||||
a : Int32
|
||||
end
|
||||
end
|
||||
CRYSTAL
|
||||
end
|
||||
|
||||
it "doesn't report if it's referenced" do
|
||||
expect_no_issues subject, <<-CRYSTAL
|
||||
def foo
|
||||
|
|
|
@ -39,6 +39,8 @@ module Ameba::Rule::Lint
|
|||
end
|
||||
|
||||
def test(source, node, scope : AST::Scope)
|
||||
return if scope.lib_def?(check_outer_scopes: true)
|
||||
|
||||
scope.variables.each do |var|
|
||||
next if var.ignored? || var.used_in_macro? || var.captured_by_block?
|
||||
next if exclude_type_declarations? && scope.assigns_type_dec?(var.name)
|
||||
|
|
Loading…
Reference in a new issue