crystal-ameba / ameba

A static code analysis tool for Crystal
https://crystal-ameba.github.io
MIT License
518 stars 38 forks source link

Report unused type declarations in `Lint/UselessAssign` rule #430

Closed Sija closed 9 months ago

Sija commented 10 months ago

Resolves #429

Sija commented 10 months ago

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.

Sija commented 9 months ago

I'm not happy with these few added # ameba:disable Lint/UselessAssign pragmas, yet I believe it's a sensible price to pay for having this bug fixed.

@veelenga Any idea how this could be optimized?

UPDATE: I've managed to resolve this in #436

Sija commented 9 months ago

@veelenga Ready for review.

veelenga commented 9 months ago

It's a tough one. Need more time to review.

Sija commented 9 months ago

I'm thinking of adding an option to exclude type declarations - in case someone would use 'em in their DSLs, WDYT @veelenga?