Skip to content

Commit

Permalink
Fix variable access within macros that are actually methods / have si…
Browse files Browse the repository at this point in the history
…de effects
  • Loading branch information
nobodywasishere committed Feb 12, 2025
1 parent a34b84e commit dd20bdc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ameba/rule/lint/unused_instance_variable_access.cr
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ module Ameba::Rule::Lint
end

def test(source, node : Crystal::InstanceVar, node_is_used : Bool, in_macro : Bool)
return if node_is_used
return if node_is_used || (in_macro && node.name.in?("type"))

issue_for node, MSG
end
Expand Down
2 changes: 1 addition & 1 deletion src/ameba/rule/lint/unused_local_variable_access.cr
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ module Ameba::Rule::Lint
end

def test(source, node : Crystal::Var, node_is_used : Bool, in_macro : Bool)
return if node_is_used || node.name.in?("self")
return if node_is_used || node.name.in?("self") || (in_macro && node.name.in?("skip_file", "debug"))

issue_for node, MSG
end
Expand Down

0 comments on commit dd20bdc

Please sign in to comment.