-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Lint/UnusedComparison
and Lint/UnusedLiteral
#507
base: master
Are you sure you want to change the base?
Add Lint/UnusedComparison
and Lint/UnusedLiteral
#507
Conversation
Nice one ❤️ I'd rename the rule to |
I'll do the code review once you mark the PR as ready for review, just FYI. |
Lint/UselessComparison
Lint/UnusedComparison
and Lint/UnusedLiteral
Yeah that's why I marked it as draft, so you wouldn't waste time reviewing it only for me to completely change it. |
Running these rules over the ameba, Kagi, and crystal compiler codebases, didn't turn up any violations. Don't know if that's due to a bug in the rules or violations being rare, though I'm leaning towards the latter. |
The only literal that isn't supported is |
Need to write more specs to ensure functionality, but from initial testing this works really well
Working implementation of Lint/UnusedLiteral Moved ImplicitReturnVisitor to its own class and expanded it
d7ff0fe
to
385ce89
Compare
Adding location to RegexLiteral in crystal-lang/crystal#15235 |
Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
Closes #235
Closes #508
This is still a little WIP, I need to go through the code again and write more / better specs. Maybe the visitor can be moved to the main visitors, as it may be useful for writing other
Lint/Useless*
rules. It's basically useful for checking if the return value from a node will be captured or not, which is how I determined whether the comparison operations were useful.