-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Refine warning about incompatible isort settings
#8192
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
Conversation
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
PR Check ResultsEcosystem✅ ecosystem check detected no changes. |
|
@charliermarsh you have a better understanding of |
afc1e44 to
e0f34f9
Compare
charliermarsh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These look correct to me. I also scanned through the full list of options and confirmed the omitted settings seem compatible too.
e0f34f9 to
55ecede
Compare
55ecede to
27257e6
Compare

Summary
This PR refines the warning shown when running
ruff formatabout incompatibleisortsettings:Only warn if
I001(unsorted imports) is enabled.lines-after-imports: Warn about values other than-1,1, and2because the formatter enforces at least one empty and at most two empty lines after imports.lines-between-types: Warn about values > 1 because the formatter preserves at most one empty line in nested import blocks.split_on_trailing_comma: Only warn whenskip-magic-trailing-commaistrueto ensure the formatter preserves the trailing commas.Remove
force-single-line: I think removing the warnings is safe. The setting seems to mainly be about removing parentheses around alieses:which the formatter leaves unchanged
Only warn about
force_wrap_aliaseswhenskip-magic-trailing-commaistrue. Isort inserts trailing commas that the formatter respects, except whenskip-magic-trailing-commaisn't set totrue.Test Plan
Added test plans. Played around with different examples in the playground to identify the
isortbehavior.