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

PLW0120 (else clause on loop without a break statement) false positive inside a match #3131

Closed
bluetech opened this issue Feb 22, 2023 · 1 comment · Fixed by #3136
Closed
Assignees
Labels
bug Something isn't working

Comments

@bluetech
Copy link
Contributor

Excited by the new match support, I ran it on a big project which contains a lot of match statements. The following is the only issue.

Snippet:

while 1:
    match 10:
        case _:
            break
else:
    print('here')

Command: ruff --isolated --select PLW0120 x.py

Expected: no violations -- the else is definitely not redundant here.

Actual:

x.py:5:1: PLW0120 `else` clause on loop without a `break` statement; remove the `else` and de-indent all the code inside it

Version: 0.0.251

@charliermarsh charliermarsh self-assigned this Feb 22, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Feb 22, 2023
@charliermarsh
Copy link
Member

Thanks, will fix today.

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 a pull request may close this issue.

2 participants