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

[ruff] - add autofix for useless-if-else (RUF034) #13852

Closed
wants to merge 1 commit into from

Conversation

diceroll123
Copy link
Contributor

Summary

Adds (sometimes-applicable) autofix for useless-if-else https://docs.astral.sh/ruff/rules/RUF034

Test Plan

cargo test

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm unsure if an autofix is a good idea for this rule, because it's hard for us to detect exactly what the mistake was. We can "fix" the code so that the violation no longer occurs, but we almost certainly can't figure out what the user actually wanted to write.

The decision not to implement an autofix for this rule in its initial implementation was a deliberate choice: see #13218 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants