Refine warning about incompatible isort settings#8192
Merged
MichaReiser merged 1 commit intomainfrom Oct 25, 2023
Merged
Conversation
Member
Author
|
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
Contributor
PR Check ResultsEcosystem✅ ecosystem check detected no changes. |
Member
Author
|
@charliermarsh you have a better understanding of |
afc1e44 to
e0f34f9
Compare
charliermarsh
approved these changes
Oct 25, 2023
Member
charliermarsh
left a comment
There was a problem hiding this comment.
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
This was referenced Oct 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.