-
Notifications
You must be signed in to change notification settings - Fork 133
Linting #705
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
base: main
Are you sure you want to change the base?
Linting #705
Conversation
|
Hi Andrew can you give me access rights for this PR please ? 😄 |
|
🚀 GPU test workflows successfully triggered! |
|
Motivations for the ignores of each rules:
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #705 +/- ##
==========================================
+ Coverage 84.61% 84.66% +0.05%
==========================================
Files 208 208
Lines 21281 21345 +64
Branches 2893 2889 -4
==========================================
+ Hits 18006 18072 +66
+ Misses 2359 2355 -4
- Partials 916 918 +2 ☔ View full report in Codecov by Sentry. |
|
I think this is ready for review, check my comment above for more details / motivations behind some linting exceptions. While a large portion of the changes were performed automatically by |
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.
Thanks guys! @Andrewwango @Tmodrzyk
I did a 1st pass and identified one rule (N805) that I believe can be enabled right away without much discussion and distilled it in #892
I find the other rules trickier mostly due to either
- not being currently breached anywhere
- needing to be fixed manually / nontrivial
- not providing a clear benefit as far as I can tell at the moment
The PR is also a bit difficult to review given the intermingling of automated and manual fixes - I prefer if we distill it into multiple PRs if that's okay with everyone (happy to do the git shenanigans to avoid loosing / having to redo work)
I'll do a 2nd pass shortly
|
I agree that the PR is very hard to review between automatic and manual fixes. Dividing it into multiple PRs would be better but I'm afraid that I made the CI pass only in the last few commits, so taking only previous commits might break things. |
|
@Tmodrzyk Yeah it would definitely be easier if we could just extract the commits here but I have a couple other tricks up my sleeve I think it's going to be doable. I'll start with extracting stuff related to E402 first we'll see how it goes! Quick questions:
|
|
Hi @jscanvic !
OOps I think I did an error with the last commit ? |
|
But it is already ignored in the main branch, not that it matters too much Thanks for adding the rule that was dropped! I'll have a look shortly |
nucli-vicky
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.
Copying a comment I made in #910 which turns out to not be relevant there, but still relevant here :)
| raise NotImplementedError("Undefined type: ".format(t)) | ||
| raise NotImplementedError("Undefined type: ") |
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 makes the error message less informative; I think we can simply make it something like
raise NotImplementedError(f"Invalid part in mode: {t}")
* add F821 822 823 * add minor fix from #705
Add more ruff rules for better linting.
For more details, see the hackathon project: #700 (comment)
Closes #539
Help wanted! If you want to help, just choose a rule in the ones added, and try to fix the code to make ruff pass it!
Checks to be done before submitting your PR
python3 -m pytest deepinv/testsruns successfully.black .runs successfully.make htmlruns successfully (in thedocs/directory).