Remi-Gau / nilearn

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

TEST (Sourcery refactored) #21

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.03%.

Quality metrics Before After Change
Complexity 4.48 ⭐ 4.22 ⭐ -0.26 👍
Method Length 213.71 ⛔ 213.59 ⛔ -0.12 👍
Working memory 11.96 😞 11.99 😞 0.03 👎
Quality 51.20% 🙂 51.23% 🙂 0.03% 👍
Other metrics Before After Change
Lines 11852 11788 -64
Changed files Quality Before Quality After Quality Change
examples/00_tutorials/plot_decoding_tutorial.py 40.11% 😞 40.10% 😞 -0.01% 👎
examples/01_plotting/plot_atlas.py 83.28% ⭐ 83.00% ⭐ -0.28% 👎
examples/01_plotting/plot_carpet.py 49.87% 😞 49.80% 😞 -0.07% 👎
examples/01_plotting/plot_colormaps.py 48.95% 😞 52.19% 🙂 3.24% 👍
examples/01_plotting/plot_haxby_masks.py 55.38% 🙂 55.28% 🙂 -0.10% 👎
examples/01_plotting/plot_visualization.py 66.39% 🙂 66.22% 🙂 -0.17% 👎
examples/02_decoding/plot_haxby_anova_svm.py 54.70% 🙂 54.61% 🙂 -0.09% 👎
examples/02_decoding/plot_haxby_different_estimators.py 30.15% 😞 30.16% 😞 0.01% 👍
examples/02_decoding/plot_haxby_full_analysis.py 37.66% 😞 37.62% 😞 -0.04% 👎
examples/02_decoding/plot_haxby_grid_search.py 33.56% 😞 33.55% 😞 -0.01% 👎
examples/02_decoding/plot_haxby_multiclass.py 45.53% 😞 45.51% 😞 -0.02% 👎
examples/02_decoding/plot_haxby_searchlight.py 44.54% 😞 44.51% 😞 -0.03% 👎
examples/02_decoding/plot_miyawaki_encoding.py 48.45% 😞 49.16% 😞 0.71% 👍
examples/02_decoding/plot_miyawaki_reconstruction.py 49.48% 😞 49.26% 😞 -0.22% 👎
examples/02_decoding/plot_oasis_vbm.py 39.20% 😞 39.19% 😞 -0.01% 👎
examples/03_connectivity/plot_compare_decomposition.py 50.42% 🙂 50.40% 🙂 -0.02% 👎
examples/03_connectivity/plot_data_driven_parcellations.py 36.40% 😞 36.40% 😞 0.00%
examples/03_connectivity/plot_inverse_covariance_connectome.py 63.09% 🙂 63.02% 🙂 -0.07% 👎
examples/03_connectivity/plot_multi_subject_connectome.py 59.92% 🙂 59.82% 🙂 -0.10% 👎
examples/03_connectivity/plot_probabilistic_atlas_extraction.py 64.16% 🙂 64.09% 🙂 -0.07% 👎
examples/03_connectivity/plot_signal_extraction.py 43.20% 😞 38.95% 😞 -4.25% 👎
examples/03_connectivity/plot_sphere_based_connectome.py 34.90% 😞 34.90% 😞 0.00%
examples/04_glm_first_level/plot_bids_features.py 48.54% 😞 48.53% 😞 -0.01% 👎
examples/04_glm_first_level/plot_fir_model.py 49.79% 😞 49.79% 😞 0.00%
examples/04_glm_first_level/plot_first_level_details.py 58.58% 🙂 58.48% 🙂 -0.10% 👎
examples/04_glm_first_level/plot_predictions_residuals.py 38.09% 😞 38.09% 😞 0.00%
examples/04_glm_first_level/plot_spm_multimodal_faces.py 41.07% 😞 41.07% 😞 0.00%
examples/04_glm_first_level/plot_write_events_file.py 61.16% 🙂 61.13% 🙂 -0.03% 👎
examples/05_glm_second_level/plot_second_level_association_test.py 49.95% 😞 49.93% 😞 -0.02% 👎
examples/05_glm_second_level/plot_second_level_design_matrix.py 70.41% 🙂 70.67% 🙂 0.26% 👍
examples/06_manipulating_images/plot_compare_mean_image.py 81.23% ⭐ 80.94% ⭐ -0.29% 👎
examples/06_manipulating_images/plot_mask_computation.py 48.34% 😞 48.32% 😞 -0.02% 👎
examples/06_manipulating_images/plot_nifti_labels_simple.py 65.65% 🙂 65.56% 🙂 -0.09% 👎
examples/06_manipulating_images/plot_nifti_simple.py 59.74% 🙂 59.67% 🙂 -0.07% 👎
examples/06_manipulating_images/plot_roi_extraction.py 36.87% 😞 36.86% 😞 -0.01% 👎
examples/06_manipulating_images/plot_smooth_mean_image.py 80.68% ⭐ 80.53% ⭐ -0.15% 👎
examples/07_advanced/plot_advanced_decoding_scikit.py 38.45% 😞 38.45% 😞 0.00%
examples/07_advanced/plot_bids_analysis.py 49.34% 😞 49.30% 😞 -0.04% 👎
examples/07_advanced/plot_haxby_mass_univariate.py 40.17% 😞 40.16% 😞 -0.01% 👎
examples/07_advanced/plot_ica_neurovault.py 32.82% 😞 31.90% 😞 -0.92% 👎
examples/07_advanced/plot_ica_resting_state.py 66.56% 🙂 66.47% 🙂 -0.09% 👎
examples/07_advanced/plot_localizer_mass_univariate_methods.py 46.40% 😞 46.39% 😞 -0.01% 👎
examples/07_advanced/plot_neurovault_meta_analysis.py 75.32% ⭐ 73.23% 🙂 -2.09% 👎
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!