Skip to content
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

STYLE: Transition to ruff for code formatting #114

Merged

Conversation

jhlegarreta
Copy link
Collaborator

Transition to ruff for code formatting in line with the rest of the nipreps repositories.

Drop the flake8 W503 rule, which is not implemented by ruff.

Add a GHA workflow to ensure that contributions not complying with the style are detected.

Format the source code accordingly.

@jhlegarreta jhlegarreta force-pushed the TransitionToRuffCodeFormatting branch from f667ee1 to c4124fc Compare May 10, 2024 23:16
Copy link

codecov bot commented May 10, 2024

Codecov Report

Attention: Patch coverage is 83.69565% with 15 lines in your changes are missing coverage. Please review.

Project coverage is 58.63%. Comparing base (ba1f12a) to head (d8f3beb).
Report is 15 commits behind head on main.

Files Patch % Lines
nireports/reportlets/utils.py 66.66% 3 Missing ⚠️
nireports/interfaces/reporting/base.py 60.00% 2 Missing ⚠️
nireports/reportlets/modality/dwi.py 50.00% 2 Missing ⚠️
nireports/reportlets/mosaic.py 85.71% 2 Missing ⚠️
nireports/reportlets/notebook.py 50.00% 2 Missing ⚠️
nireports/reportlets/nuisance.py 71.42% 1 Missing and 1 partial ⚠️
nireports/interfaces/fmri.py 80.00% 1 Missing ⚠️
nireports/interfaces/mosaic.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #114      +/-   ##
==========================================
+ Coverage   58.45%   58.63%   +0.18%     
==========================================
  Files          22       22              
  Lines        2094     2096       +2     
  Branches      322      365      +43     
==========================================
+ Hits         1224     1229       +5     
+ Misses        787      783       -4     
- Partials       83       84       +1     
Flag Coverage Δ
unittests 58.47% <83.69%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jhlegarreta jhlegarreta force-pushed the TransitionToRuffCodeFormatting branch from c4124fc to de36988 Compare May 10, 2024 23:19
@jhlegarreta
Copy link
Collaborator Author

A few notes:

Which is more comprehensive (?), as it runs all pre-commit hooks (not only ruff). Otherwise, we may need to add the --show-fixes or --show-diff-on-failure flags.

So the same is probably happening across all nipreps repositories 😬.

  • I would leave out for now the B019 and C901 errors: fixing those requires more time.

@jhlegarreta jhlegarreta force-pushed the TransitionToRuffCodeFormatting branch 2 times, most recently from b282731 to aee610d Compare May 10, 2024 23:56
@jhlegarreta jhlegarreta marked this pull request as draft May 11, 2024 00:01
Transition to `ruff` for code formatting in line with the rest of the
`nipreps` repositories.

Drop the flake8 `W503` rule, which is not implemented by `ruff`.

Add a GHA workflow to ensure that contributions not complying with the
style are detected.

Format the source code accordingly.
@jhlegarreta jhlegarreta force-pushed the TransitionToRuffCodeFormatting branch from aee610d to d8f3beb Compare May 11, 2024 13:38
@jhlegarreta jhlegarreta marked this pull request as ready for review May 11, 2024 13:40
@jhlegarreta
Copy link
Collaborator Author

@effigies @oesteban Should we add B019 and C901 to the whitelist until we have time to look at them?

@effigies
Copy link
Member

@jhlegarreta Yes, let's ignore those for now.

@jhlegarreta jhlegarreta merged commit 43dd874 into nipreps:main May 15, 2024
21 of 22 checks passed
@jhlegarreta jhlegarreta deleted the TransitionToRuffCodeFormatting branch May 15, 2024 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants