-
Notifications
You must be signed in to change notification settings - Fork 10
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
Overhaul linting and formatting #156
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #156 +/- ##
==========================================
+ Coverage 99.28% 99.63% +0.35%
==========================================
Files 9 9
Lines 557 554 -3
==========================================
- Hits 553 552 -1
+ Misses 4 2 -2 ☔ View full report in Codecov by Sentry. |
Tagging @neuroinformatics-unit/behaviour and @b-peri, because these changes will affect workflows for all. |
Thanks again @niksirbi ! Happy to merge once the following two things are addressed:
|
Assuming these changes aren't too specific to |
Yes, the plan was to roll them out in |
@lochhh I can't reproduce this on Mac. Running |
Thanks for looking into this. Can confirm it is indeed my IDE that's automatically converting the line endings. |
Quality Gate passedIssues Measures |
Thanks for verifying @lochhh. I'll merge this now. |
Description
What is this PR
Why is this PR needed?
We use
ruff
for linting andblack
for auto-formatting. With the introduction ofruff.format
(a drop-in replacement forblack
, but faster) there is no longer need to be usingblack
. This prompted me to overhaul our entire lint/format setup.What does this PR do?
I went through the scientific python development guide for style and static checks and applied the recommendations that make sense for
movement
.In summary these are:
black
toruff.format
E
,F
, andI
. With the addition ofUP
,B
,SIM
, andC90
I discovered and fixed a few minor problems that the other checks had missed. That said, there were only a few extra issues, which means we are already great Python coders 😉 .check-added-large-files
andcheck-yaml
.What does this PR NOT do?
I also considered adding the "D"
ruff
rule (pydocstyle) to enforce consistent formatting for our docstrings (according to PEP8 recommendations). I think this is super useful, but currently requires some manual work to update lots of our non-compliant docstrings (135 non auto-fixable violations!). I will open an issue to do this later.References
If we end up being happy with the new setup, we may consider porting it over to the python-cookiecutter.
Does this PR require an update to the documentation?
The contributed guidelines have been updated accordingly.
Checklist: