Closed sourcery-ai[bot] closed 1 year ago
👋 @sourcery-ai[bot] Thanks for creating a PR!
Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.
Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.
Closes #XXXX
(see our documentation on PR structure)doc/changes/latest.rst
(see our documentation on PR structure)
For new features:We will review it as quick as possible, feel free to ping us with questions if needed.
✅ Merging this PR will increase code quality in the affected files by 0.06%.
Quality metrics | Before | After | Change |
---|---|---|---|
Complexity | 14.16 🙂 | 13.98 🙂 | -0.18 👍 |
Method Length | 160.83 😞 | 160.17 😞 | -0.66 👍 |
Working memory | 12.29 😞 | 12.29 😞 | 0.00 |
Quality | 47.99% 😞 | 48.05% 😞 | 0.06% 👍 |
Other metrics | Before | After | Change |
---|---|---|---|
Lines | 7015 | 7003 | -12 |
Changed files | Quality Before | Quality After | Quality Change |
---|---|---|---|
nilearn/datasets/func.py | 46.43% 😞 | 46.11% 😞 | -0.32% 👎 |
nilearn/datasets/tests/test_func.py | 70.95% 🙂 | 70.77% 🙂 | -0.18% 👎 |
nilearn/glm/first_level/first_level.py | 24.78% ⛔ | 24.97% ⛔ | 0.19% 👍 |
nilearn/image/resampling.py | 36.43% 😞 | 37.29% 😞 | 0.86% 👍 |
nilearn/image/tests/test_resampling.py | 61.73% 🙂 | 61.73% 🙂 | 0.00% |
nilearn/mass_univariate/permuted_least_squares.py | 25.17% 😞 | 25.76% 😞 | 0.59% 👍 |
Here are some functions in these files that still need a tune-up:
File | Function | Complexity | Length | Working Memory | Quality | Recommendation |
---|---|---|---|---|---|---|
nilearn/glm/first_level/first_level.py | first_level_from_bids | 84 ⛔ | 834 ⛔ | 39 ⛔ | 0.66% ⛔ | Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions |
nilearn/datasets/func.py | fetch_localizer_contrasts | 51 ⛔ | 944 ⛔ | 4.49% ⛔ | Refactor to reduce nesting. Try splitting into smaller methods | |
nilearn/image/resampling.py | resample_img | 40 ⛔ | 813 ⛔ | 26 ⛔ | 7.21% ⛔ | Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions |
nilearn/glm/first_level/first_level.py | FirstLevelModel.fit | 57 ⛔ | 752 ⛔ | 18 ⛔ | 7.70% ⛔ | Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions |
nilearn/mass_univariate/permuted_least_squares.py | permuted_ols | 34 ⛔ | 846 ⛔ | 30 ⛔ | 8.56% ⛔ | Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions |
The emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.
Please see our documentation here for details on how these metrics are calculated.
We are actively working on this report - lots more documentation and extra metrics to come!
Help us improve this quality report!
Merging #18 (7d16214) into refactor_complex_functions (0e8ee70) will decrease coverage by
0.02%
. The diff coverage is78.84%
.
@@ Coverage Diff @@
## refactor_complex_functions #18 +/- ##
==============================================================
- Coverage 91.09% 91.08% -0.02%
==============================================================
Files 133 133
Lines 15387 15351 -36
Branches 3028 3016 -12
==============================================================
- Hits 14017 13982 -35
- Misses 809 814 +5
+ Partials 561 555 -6
Impacted Files | Coverage Δ | |
---|---|---|
nilearn/datasets/func.py | 78.61% <67.74%> (+0.25%) |
:arrow_up: |
nilearn/connectome/group_sparse_cov.py | 81.23% <88.88%> (+0.29%) |
:arrow_up: |
nilearn/glm/first_level/first_level.py | 92.91% <100.00%> (-0.10%) |
:arrow_down: |
nilearn/image/resampling.py | 93.69% <100.00%> (-0.06%) |
:arrow_down: |
nilearn/mass_univariate/permuted_least_squares.py | 91.55% <100.00%> (+1.12%) |
:arrow_up: |
nilearn/__init__.py | 80.00% <0.00%> (-10.00%) |
:arrow_down: |
nilearn/plotting/__init__.py | 83.33% <0.00%> (-10.00%) |
:arrow_down: |
nilearn/glm/thresholding.py | 95.78% <0.00%> (-2.11%) |
:arrow_down: |
nilearn/_utils/testing.py | 65.30% <0.00%> (-2.05%) |
:arrow_down: |
nilearn/regions/parcellations.py | 95.04% <0.00%> (-0.83%) |
:arrow_down: |
... and 1 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
Pull Request #17 refactored by Sourcery.
If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.
NOTE: As code is pushed to the original Pull Request, Sourcery will re-run and update (force-push) this Pull Request with new refactorings as necessary. If Sourcery finds no refactorings at any point, this Pull Request will be closed automatically.
See our documentation here.
Run Sourcery locally
Reduce the feedback loop during development by using the Sourcery editor plugin:
Review changes via command line
To manually merge these changes, make sure you're on the
refactor_complex_functions
branch, then run:Help us improve this pull request!