-
Notifications
You must be signed in to change notification settings - Fork 16
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
Adopt more ruff rules to align with AWB codebase #785
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #785 +/- ##
=======================================
Coverage 68.21% 68.22%
=======================================
Files 45 45
Lines 4147 4148 +1
=======================================
+ Hits 2829 2830 +1
Misses 1318 1318
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
target-version = "py39" | ||
|
||
[tool.ruff.lint] | ||
ignore = ["E501", "E402", "TRY003", "RUF012", "N806"] |
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.
Should we add docstring about this one to keep in mind when to use them ?
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.
I am not sure what you mean by this comment? These are rules that we do not enforce, for various reasons, mostly because they would be too tedious to enforce. You can learn by each of them by running
ruff rule <rule_code>
cc6f17c
to
d0d22a9
Compare
Fixed 30 errors: - src/aiidalab_qe/app/configuration/pseudos.py: 1 × C408 (unnecessary-collection-call) - src/aiidalab_qe/common/bandpdoswidget.py: 8 × C408 (unnecessary-collection-call) 1 × UP031 (printf-string-formatting) 1 × UP032 (f-string) - src/aiidalab_qe/common/node_view.py: 1 × C408 (unnecessary-collection-call) - src/aiidalab_qe/common/process.py: 1 × C408 (unnecessary-collection-call) - src/aiidalab_qe/common/widgets.py: 4 × RUF005 (collection-literal-concatenation) 3 × C408 (unnecessary-collection-call) - src/aiidalab_qe/plugins/bands/workchain.py: 1 × B007 (unused-loop-control-variable) - src/aiidalab_qe/plugins/pdos/workchain.py: 1 × C405 (unnecessary-literal-set) - src/aiidalab_qe/plugins/xas/setting.py: 1 × C416 (unnecessary-comprehension) - src/aiidalab_qe/plugins/xps/result.py: 1 × C408 (unnecessary-collection-call) - src/aiidalab_qe/plugins/xps/workchain.py: 2 × RUF015 (unnecessary-iterable-allocation-for-first-element) - tests/test_plugins_electronic_structure.py: 1 × RUF015 (unnecessary-iterable-allocation-for-first-element) - tests/test_pseudo.py: 3 × C416 (unnecessary-comprehension)
@AndresOrtegaGuerrero thank you for the review, please see my replies. I've changed the configuration so that ruff now checks notebooks directly as well, and removed the |
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 your work @danielhollas LGTM! , I was wondering if @superstar54 or @PNOGillespie can check the XPS part in particular the test where there are lines not used.
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 for the work. LGTM!
I've copied over the ruff configuration from AWB which served us well so far. Most of the necessary fixes were done automatically, I've done around 20 of them manually.
TODO: fix violations in notebooks and use ruff to lint notebooks directly.