Skip to content

Fix RUF028 not allowing # fmt: skip on match cases#10178

Merged
snowsignal merged 1 commit into
mainfrom
jane/linter/ruf028/match-case-header
Mar 1, 2024
Merged

Fix RUF028 not allowing # fmt: skip on match cases#10178
snowsignal merged 1 commit into
mainfrom
jane/linter/ruf028/match-case-header

Conversation

@snowsignal
Copy link
Copy Markdown
Contributor

Summary

Fixes #10174 by allowing match cases to be enclosing nodes for suppression comments. else/elif clauses are now also allowed to be enclosing nodes.

Test Plan

I've added the offending code from the original issue to the RUF028 snapshot test, and I've also expanded it to test the allowed else/elif clause.

@snowsignal snowsignal added the bug Something isn't working label Mar 1, 2024
@snowsignal snowsignal requested a review from MichaReiser March 1, 2024 05:56
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 1, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@snowsignal snowsignal merged commit 8ecdf53 into main Mar 1, 2024
@snowsignal snowsignal deleted the jane/linter/ruf028/match-case-header branch March 1, 2024 08:36
nkxxll pushed a commit to nkxxll/ruff that referenced this pull request Mar 10, 2024
## Summary

Fixes astral-sh#10174 by allowing match cases to be enclosing nodes for
suppression comments. `else/elif` clauses are now also allowed to be
enclosing nodes.

## Test Plan
I've added the offending code from the original issue to the `RUF028`
snapshot test, and I've also expanded it to test the allowed `else/elif`
clause.
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.

Invalid RUF028 for match case header

2 participants