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

Fix handling of trailing target comment #9051

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

MichaReiser
Copy link
Member

Summary

This PR fixes an issue where Ruff moved a trailing target comment past the statement end

c = b[dddddd, aaaaaa] =  (
    a[
        aaaaaaa,
        bbbbbbbbbbbbbbbbbbb
    ] 
    # comment 2
) = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Before

c = b[dddddd, aaaaaa] = a[
    aaaaaaa, bbbbbbbbbbbbbbbbbbb
] = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# comment 2

Now

c = b[dddddd, aaaaaa] = (
    a[aaaaaaa, bbbbbbbbbbbbbbbbbbb]
    # comment 2
) = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Which matches black's formatting

Test Plan

Added test

@MichaReiser
Copy link
Member Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@MichaReiser MichaReiser added bug Something isn't working formatter Related to the formatter labels Dec 8, 2023
@MichaReiser MichaReiser force-pushed the fix-statement-target-with-trailing-comment branch from e3eccf3 to abf64db Compare December 8, 2023 04:35
Copy link
Contributor

github-actions bot commented Dec 8, 2023

ruff-ecosystem results

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser merged commit d0d88d9 into main Dec 8, 2023
17 checks passed
@MichaReiser MichaReiser deleted the fix-statement-target-with-trailing-comment branch December 8, 2023 05:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants