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

Avoid TCH005 for if stmt with elif/else block #11376

Merged
merged 1 commit into from
May 13, 2024
Merged

Conversation

dhruvmanila
Copy link
Member

Summary

This PR fixes a bug where the auto-fix for TCH005 would delete the entire if statement.

The fix in this PR is to not consider it a violation if there are any elif/else blocks. This also matches the behavior of the original plugin.

fixes: #11368

Test plan

Add test cases.

@dhruvmanila dhruvmanila added the bug Something isn't working label May 12, 2024
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@charliermarsh charliermarsh merged commit d835b3e into main May 13, 2024
19 checks passed
@charliermarsh charliermarsh deleted the dhruv/tch005-fix branch May 13, 2024 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TCH005 autofix deletes else block, removes functional code.
2 participants