Closed straight-shoota closed 8 months ago
@Sija citing https://github.com/crystal-ameba/ameba/pull/430#issuecomment-1854999845 here for clarity:
As type declarations are often used as part of DSLs and within accessor macros, I see no reliable way to mark them as unused assignments.
I'm not sure I get the issue you're seeing. For all I can tell, the use of type declarations in DSLs and accessor macros should be pretty much the same as with assignments. Ameba is able to handle getter foo = 1
, right? Why is getter foo : Int32
problematic?
For all I can tell, the use of type declarations in DSLs and accessor macros should be pretty much the same as with assignments.
Ameba itself allows/uses them within the properties
macro.
Perhaps it would be possible to exclude 'em somehow... just thinking out loud here.
Ameba is able to handle
getter foo = 1
, right? Why isgetter foo : Int32
problematic?
Good question. I believe it's due to some custom logic I've missed in the PR.
Lint/UselessAssign
rule reports local variables that are defined per assignment but never used.Type declarations also declare a variable yet do not assign to the variable. This should even more reason to report it.
For the following program, ameba should report a similar issue:
This came up in https://github.com/crystal-lang/crystal/issues/14058