Skip to content

RUF022, RUF023: never add two trailing commas to the end of a sequence#9698

Merged
AlexWaygood merged 6 commits intoastral-sh:mainfrom
AlexWaygood:fix-syntax-errors2
Jan 30, 2024
Merged

RUF022, RUF023: never add two trailing commas to the end of a sequence#9698
AlexWaygood merged 6 commits intoastral-sh:mainfrom
AlexWaygood:fix-syntax-errors2

Conversation

@AlexWaygood
Copy link
Member

Fixes the issues highlighted in #8402 (comment) and #8402 (comment)

@github-actions
Copy link
Contributor

github-actions bot commented Jan 30, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Comment on lines +1009 to +1022
ℹ Safe fix
241 241 | ]
242 242 |
243 243 | __all__ = (
244 |- "foo"
245 244 | # strange comment 1
246 |- ,
247 245 | # comment about bar
248 |- "bar"
246 |+ "bar",
247 |+ "foo"
249 248 | # strange comment 2
250 249 | ,
251 250 | )
Copy link
Member Author

@AlexWaygood AlexWaygood Jan 30, 2024

Choose a reason for hiding this comment

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

It's hard to say where a comment like # strange comment 1 should go really, if it lies between the string item and the associated comma. Possibly it should move with "foo", even though it's directly above "bar". But this is a very unlikely edge case, and the important thing is that the comment isn't deleted, in my opinion.

@AlexWaygood AlexWaygood added bug Something isn't working fixes Related to suggested fixes for violations labels Jan 30, 2024
@AlexWaygood AlexWaygood merged commit 0c8d140 into astral-sh:main Jan 30, 2024
@AlexWaygood AlexWaygood deleted the fix-syntax-errors2 branch January 30, 2024 17:19
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.

3 participants