Remi-Gau / nilearn

Machine learning for NeuroImaging in Python
http://nilearn.github.io
Other
1 stars 1 forks source link

TEST (Sourcery refactored) #22

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

Pull Request #20 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 format_image_example branch, then run:

git fetch origin sourcery/format_image_example
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.27%.

Quality metrics Before After Change
Complexity 7.81 ⭐ 7.35 ⭐ -0.46 👍
Method Length 147.51 😞 147.33 😞 -0.18 👍
Working memory 10.06 😞 9.91 😞 -0.15 👍
Quality 56.40% 🙂 56.67% 🙂 0.27% 👍
Other metrics Before After Change
Lines 3908 3883 -25
Changed files Quality Before Quality After Quality Change
nilearn/image/image.py 56.93% 🙂 56.91% 🙂 -0.02% 👎
nilearn/image/resampling.py 28.51% 😞 29.71% 😞 1.20% 👍
nilearn/image/tests/test_image.py 64.96% 🙂 64.96% 🙂 0.00%
nilearn/image/tests/test_resampling.py 61.74% 🙂 61.74% 🙂 0.00%

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
nilearn/image/resampling.py resample_img 54 ⛔ 901 ⛔ 26 ⛔ 4.16% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
nilearn/image/image.py new_img_like 31 😞 253 ⛔ 12 😞 27.14% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
nilearn/image/resampling.py reorder_img 10 🙂 409 ⛔ 15 😞 33.36% 😞 Try splitting into smaller methods. Extract out complex expressions
nilearn/image/image.py _smooth_array 18 🙂 216 ⛔ 11 😞 38.94% 😞 Try splitting into smaller methods. Extract out complex expressions
nilearn/image/image.py clean_img 7 ⭐ 197 😞 20 ⛔ 39.46% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

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!

github-actions[bot] commented 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.

For new features:

For bug fixes:

We will review it as quick as possible, feel free to ping us with questions if needed.