Skip to content
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

Condition in void context #235

Closed
szabgab opened this issue May 19, 2021 · 0 comments · Fixed by #507
Closed

Condition in void context #235

szabgab opened this issue May 19, 2021 · 0 comments · Fixed by #507

Comments

@szabgab
Copy link

szabgab commented May 19, 2021

The == most like was supposed to be = here.

x = 23
x == 42
puts x
@Sija Sija added rule and removed feature labels Oct 30, 2022
nobodywasishere added a commit to nobodywasishere/ameba that referenced this issue Nov 22, 2024
@Sija Sija changed the title New Rule: Condition in void context Condition in void context Nov 25, 2024
nobodywasishere added a commit to nobodywasishere/ameba that referenced this issue Nov 27, 2024
@Sija Sija added this to the 1.7.0 milestone Nov 30, 2024
Sija added a commit that referenced this issue Dec 7, 2024
* Basic implementation of Lint/UselessComparison (#235)

* More comprehensive useless comparison rule using custom visitor

Need to write more specs to ensure functionality, but from initial testing this works really well

* Fix case statement implicit obj comparisons

* UselessComparison -> UnusedComparison
Working implementation of Lint/UnusedLiteral
Moved ImplicitReturnVisitor to its own class and expanded it

* Better UnusedLiteral specs and docs

* Remove accidental hello

* Add "since_version"

* Apply suggestions from code review

Co-authored-by: Sijawusz Pur Rahnama <[email protected]>

* visit methods return bool, add StringInterpolation support

* Apply suggestions from code review

Co-authored-by: Sijawusz Pur Rahnama <[email protected]>

* Add support for Regex literals to Lint/UnusedLiteral gated by Crystal 1.15

* test methods shouldnt return bool
RegexLiteral values should be counted as used
Add spec ensuring unused regex literals aren't counted for Crystal < 1.15

---------

Co-authored-by: Sijawusz Pur Rahnama <[email protected]>
@Sija Sija closed this as completed in #507 Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants