-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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] no-duplicates
: ensure autofix avoids excessive newlines
#2028
Conversation
592a40c
to
ab5c36e
Compare
ea2cab3
to
d2a7722
Compare
no-duplicates
: ensure autofix avoids excessive newlines
ebb3f91
to
b48001b
Compare
@ertrzyiks looks like these are legit failures. Please mark the PR as "ready for review" when you've got them passing (or ping me if you're stuck) |
@ljharb as I mentioned #2027 (comment) it seems to me that the auto-fix would need to be too smart to remove the import in a clean way. The failed examples highlighted issues with leading spaces
Becomes
Because I removed only the new line characters. We could either rewrite tests to not have leading spaces and they will pass, or we can clean all spaces that occur before the import. WDYT? |
hmm, that's a good question. in this case, since import statements are always at the top level of the module, it doesn't make any sense to have leading spaces before |
Alright, I will update the tests and will mark the PR as ready for review once green. Thanks for the feedback @ljharb |
7297422
to
b9de5e4
Compare
9c78340
to
7aea664
Compare
Fixes #2027
Each removed import can potentially leave an empty line character. When a module has multiple repeated imports, the output of the autofix includes a gap of empty lines. The number of empty lines are equal to the number of removed imports.
becomes
Remove a new line character if it's immediately after the removed import.