Skip to content

[flake8-pie] Correctly remove wrapping parentheses (PIE800)#15394

Merged
MichaReiser merged 2 commits intoastral-sh:mainfrom
InSyncWithFoo:PIE800
Jan 10, 2025
Merged

[flake8-pie] Correctly remove wrapping parentheses (PIE800)#15394
MichaReiser merged 2 commits intoastral-sh:mainfrom
InSyncWithFoo:PIE800

Conversation

@InSyncWithFoo
Copy link
Copy Markdown
Contributor

Summary

Resolves #15366.

Test Plan

cargo nextest run and cargo insta test.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 10, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser added bug Something isn't working fixes Related to suggested fixes for violations labels Jan 10, 2025
@MichaReiser MichaReiser enabled auto-merge (squash) January 10, 2025 14:48
@MichaReiser MichaReiser merged commit c364b58 into astral-sh:main Jan 10, 2025
@InSyncWithFoo InSyncWithFoo deleted the PIE800 branch January 10, 2025 14:53
charliermarsh pushed a commit that referenced this pull request Jan 13, 2025
## Summary

Follow-up to #15394. See [this review
comment](#15394 (comment)).

## Test Plan

`cargo nextest run` and `cargo insta test`.
MichaReiser pushed a commit that referenced this pull request Feb 7, 2025
…tionary is empty (`PIE800`) (#16008)

## Summary

Resolves #15997.

Ruff used to introduce syntax errors while fixing these cases, but no
longer will:

```python
{"a": [], **{},}
#         ^^^^ Removed, leaving two contiguous commas

{"a": [], **({})}
#         ^^^^^ Removed, leaving a stray closing parentheses
```

Previously, the function would take a shortcut if the unpacked
dictionary is empty; now, both cases are handled using the same logic
introduced in #15394. This change slightly modifies that logic to also
remove the first comma following the dictionary, if and only if it is
empty.

## Test Plan

`cargo nextest run` and `cargo insta test`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fixes Related to suggested fixes for violations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix introduced a syntax error with PIE800

3 participants