-
Notifications
You must be signed in to change notification settings - Fork 41
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
Use isort to order import statements #641
Conversation
1abbbd6
to
fa8e471
Compare
Codecov ReportBase: 99.58% // Head: 99.58% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #641 +/- ##
==========================================
- Coverage 99.58% 99.58% -0.01%
==========================================
Files 87 87
Lines 5991 5972 -19
==========================================
- Hits 5966 5947 -19
Misses 25 25
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
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.
Looks very good. A couple of quick comments:
- isort seems to have a Black profile, we should probably enable that in
pyproject.toml
for maximum compatibility (whatever it does, I'm not sure) - now that both Black and isort will be expected from commits, it would be good to create a CONTRIBUTING.md file which documents, among other things, what style checks/fixups to perform before committing. This seems to be a good introduction to writing one. (this could of course be another PR, not part of this one)
Done already in Configure isort to be compatible with Black.
👍 |
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.
Ah, right, I somehow missed the changes to pyproject.toml even though I looked for them...
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
PR #640 introduced Black style and tool for checking and autoformatting code. However, Black does not care about the order of import statements, but isort does. Using isort a developer does not need worry about the order of imports.
This PR contains similar changes as the one for Black.
Manual local usage
Just run this to sort imports:
Automated local usage
isort can check the import order automatically when committing by adding this line to
.git/hooks/pre-commit
:CI usage
isort check is added to the linting job in GH Actions.