crystal
crystal copied to clipboard
Unused instance and local variable accesses
I've been developing new rules for ameba, and as part of that have been testing them on this repository to verify their functionality. I've found a few issues that could be fixed.
src/compiler/crystal/tools/formatter.cr:
src/compiler/crystal/syntax/parser.cr:
src/compiler/crystal/semantic/filters.cr:
There are several others, but they're mostly having the var on the last line of a method that has a Nil return.
Happy to accept a patch.
I'm not sure it makes much sense to track such individual linter issues in a ticket. As long as the code works, it's fine. Of course we'd want to improve the quality. But IMO it's not important enough to keep a bookmark for every detail. Especially considering that they should be relatively straightforward to just fix. We could have a meta issue to keep track of linter problems, though.
I agree, I'll start working on an initial PR to start fixing these and other issues. The check_end one concerns me though, as it may introduce a breaking change by fixing it. I'm fine turning this into a ticket to keep track of linter issues / discuss them
Related:
- #14608
Of course, if there's a problematic detail to discuss on a specific linter issue, such a discussion is much appreciated.
It wasn't clear to me that the check_end variable is shadowing a method. So yeah we ought to be careful about that. Apparently the formatter specs are not dense enough to catch that these check_end are not actually checking the end.