-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Correct/clarify message for wrong-import-order #9236
Correct/clarify message for wrong-import-order #9236
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #9236 +/- ##
==========================================
+ Coverage 95.79% 95.81% +0.01%
==========================================
Files 173 173
Lines 18722 18761 +39
==========================================
+ Hits 17935 17975 +40
+ Misses 787 786 -1
|
This comment has been minimized.
This comment has been minimized.
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.
This look great already, the primer in particular looks very promising. Just some nits :)
This comment has been minimized.
This comment has been minimized.
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.
Thank you for the changes. Sorry I missed that we could also use fstrings in the 3 args (it's faster than string addition by a lot).
Looks like there are a few things I should add or change in the test to improve code coverage. I'll work on that over the next day or so and push a commit with those updates. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
Look amazing, the message is sometime long, let me know what you think of the proposal.
This comment has been minimized.
This comment has been minimized.
Classifying as enhancement and delaying to 3.1.0 because there was a lot more done than simply fixing the original bug. |
This comment has been minimized.
This comment has been minimized.
Improve the message provided for wrong-import-order check. Instead of the import statement ("import x"), the message now specifies the import that is out of order and which imports should come after it. As reported in the issue, this is particularly helpful if there are multiple imports on a single line that do not follow the PEP8 convention. The message will report imports as follows: - For "import X", it will report "(standard/third party/first party/local) import X" - For "import X.Y" and "from X import Y", it will report "(standard/third party/first party/local) import X.Y" The import category is specified to provide explanation as to why pylint has issued the message and guidence to the developer on how to fix the problem. Closes pylint-dev#8808 Co-authored-by: Pierre Sassoulas <[email protected]>
New sphinx now check that a block of code is valid.
63a9ed3
to
8bff674
Compare
Improve the message provided for wrong-import-order check. Instead of the import statement ("import x"), the message now specifies the import that is out of order and which imports should come after it. As reported in the issue, this is particularly helpful if there are multiple imports on a single line that do not follow the PEP8 convention. The message will report imports as follows: - For "import X", it will report "(standard/third party/first party/local) import X" - For "import X.Y" and "from X import Y", it will report "(standard/third party/first party/local) import X.Y" The import category is specified to provide explanation as to why pylint has issued the message and guidence to the developer on how to fix the problem. Closes #8808 Co-authored-by: Pierre Sassoulas <[email protected]>
π€ Effect of this PR on checked open source code: π€ Effect on home-assistant:
Effect on pygame:
The following messages are no longer emitted:
Effect on black:
The following messages are no longer emitted:
Effect on music21:
The following messages are no longer emitted:
Effect on pytest:
The following messages are no longer emitted:
Effect on django:
The following messages are no longer emitted:
Effect on pandas:
The following messages are no longer emitted:
Effect on sentry:
This comment was truncated because GitHub allows only 65536 characters in a comment. This comment was generated for commit 8bff674 |
Type of Changes
Description
Adds clarification in the message for the wrong-import-order check.
The original message was confusing, especially when multiple imports were on a single line, because the entire import statement is listed twice in the message (
"import X, Y, Z" should be placed before "import X, Y, Z"
).Changes were made to extract the "current" import name and the "out of order" import names, and separate them by "isort order", so the user is able to clearly see what changes need to be made to address the problem. For example,
standard import "X" should be placed before third order import "Y" and first order import "Z"
.No functional tests were added, but the output for the wrong-import-order test was updated to reflect the new messages produced by the change. The code has passed the full
tox
test suite as well as allprimer
tests and a documentation fragment added to explain the changes.Closes #8808