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

Refactor/refactor project after 807 (Sourcery refactored) #826

Closed
wants to merge 31 commits into from

Conversation

sourcery-ai[bot]
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Sep 17, 2021

Pull Request #825 refactored by Sourcery.

Since the original Pull Request was opened as a fork in a contributor's
repository, we are unable to create a Pull Request branching from it.

To incorporate these changes, you can either:

  1. Merge this Pull Request instead of the original, or

  2. Ask your contributor to locally incorporate these commits and push them to
    the original Pull Request

    Incorporate changes via command line
    git fetch https://github.com/glotaran/pyglotaran pull/825/head
    git merge --ff-only FETCH_HEAD
    git push

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:

Help us improve this pull request!

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Sep 17, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 6.90 ⭐ 6.69 ⭐ -0.21 👍
Method Length 50.43 ⭐ 48.57 ⭐ -1.86 👍
Working memory 7.53 🙂 7.30 🙂 -0.23 👍
Quality 69.86% 🙂 71.11% 🙂 1.25% 👍
Other metrics Before After Change
Lines 4998 5392 394
Changed files Quality Before Quality After Quality Change
glotaran/analysis/optimize.py 45.91% 😞 45.71% 😞 -0.20% 👎
glotaran/analysis/problem.py 80.36% ⭐ 80.44% ⭐ 0.08% 👍
glotaran/analysis/simulation.py 64.20% 🙂 64.20% 🙂 0.00%
glotaran/builtin/io/folder/folder_plugin.py 71.72% 🙂 61.82% 🙂 -9.90% 👎
glotaran/builtin/io/folder/test/test_folder_plugin.py 86.72% ⭐ 93.57% ⭐ 6.85% 👍
glotaran/builtin/io/netCDF/netCDF.py 79.78% ⭐ 87.18% ⭐ 7.40% 👍
glotaran/builtin/io/yml/yml.py 52.74% 🙂 78.42% ⭐ 25.68% 👍
glotaran/builtin/io/yml/test/test_save_result.py 88.48% ⭐ 95.76% ⭐ 7.28% 👍
glotaran/examples/sequential.py 46.88% 😞 43.68% 😞 -3.20% 👎
glotaran/io/init.py 87.99% ⭐ 87.99% ⭐ 0.00%
glotaran/io/interface.py 97.71% ⭐ 97.52% ⭐ -0.19% 👎
glotaran/model/dataset_model.py 81.03% ⭐ 80.93% ⭐ -0.10% 👎
glotaran/model/item.py 55.63% 🙂 56.94% 🙂 1.31% 👍
glotaran/model/model.py 72.67% 🙂 73.25% 🙂 0.58% 👍
glotaran/model/property.py 43.98% 😞 48.19% 😞 4.21% 👍
glotaran/model/test/test_model.py 71.05% 🙂 70.88% 🙂 -0.17% 👎
glotaran/parameter/parameter_group.py 69.30% 🙂 69.30% 🙂 0.00%
glotaran/plugin_system/data_io_registration.py 92.67% ⭐ 92.43% ⭐ -0.24% 👎
glotaran/plugin_system/project_io_registration.py 89.03% ⭐ 87.08% ⭐ -1.95% 👎
glotaran/plugin_system/test/test_project_io_registration.py 91.22% ⭐ 91.22% ⭐ 0.00%
glotaran/project/init.py % % %
glotaran/project/result.py 69.15% 🙂 68.30% 🙂 -0.85% 👎
glotaran/project/scheme.py 90.75% ⭐ 90.05% ⭐ -0.70% 👎
glotaran/project/test/test_result.py 80.10% ⭐ 82.44% ⭐ 2.34% 👍
glotaran/project/test/test_scheme.py 76.59% ⭐ 76.97% ⭐ 0.38% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/model/item.py _create_mprint_func 45 ⛔ 275 ⛔ 10 😞 25.00% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/model/property.py ModelProperty.validate 44 ⛔ 187 😞 13 😞 25.34% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/parameter/parameter_group.py ParameterGroup.from_dataframe 28 😞 267 ⛔ 13 😞 26.41% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/analysis/optimize.py _create_result 15 🙂 256 ⛔ 23 ⛔ 27.13% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/model/item.py _create_mprint_func.mprint_item 35 ⛔ 270 ⛔ 10 😞 28.28% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

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!

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link
Contributor

Binder 👈 Launch a binder notebook on branch glotaran/pyglotaran/sourcery/pull-825

@github-actions
Copy link
Contributor

github-actions bot commented Sep 17, 2021

Benchmark is done. Checkout the benchmark result page.
Benchmark differences below 5% might be due to CI noise.

Benchmark diff

Parametrized benchmark signatures:

BenchmarkOptimize.time_optimize(index_dependent, grouped, weight)

All benchmarks:

       before           after         ratio
     [dc00e6da]       [55a61c96]
     <v0.4.0>                   
-        64.0±1ms         46.0±1ms     0.72  BenchmarkOptimize.time_optimize(False, False, False)
-         367±2ms        60.8±30ms     0.17  BenchmarkOptimize.time_optimize(False, False, True)
-        94.9±1ms       79.3±0.9ms     0.84  BenchmarkOptimize.time_optimize(False, True, False)
         95.8±1ms         91.2±3ms     0.95  BenchmarkOptimize.time_optimize(False, True, True)
       63.3±0.6ms         61.4±1ms     0.97  BenchmarkOptimize.time_optimize(True, False, False)
-         369±3ms         68.3±1ms     0.19  BenchmarkOptimize.time_optimize(True, False, True)
         97.6±1ms        100±0.9ms     1.03  BenchmarkOptimize.time_optimize(True, True, False)
         97.6±1ms         138±50ms    ~1.41  BenchmarkOptimize.time_optimize(True, True, True)
             179M             181M     1.01  IntegrationTwoDatasets.peakmem_create_result
             195M             199M     1.02  IntegrationTwoDatasets.peakmem_optimize
-         301±3ms          237±3ms     0.79  IntegrationTwoDatasets.time_create_result
-      6.10±0.01s       2.13±0.07s     0.35  IntegrationTwoDatasets.time_optimize

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 17, 2021

This pull request introduces 1 alert when merging 55a61c9 into 2f1afe7 - view on LGTM.com

new alerts:

  • 1 for Variable defined multiple times

@sourcery-ai sourcery-ai bot closed this Sep 17, 2021
@sourcery-ai sourcery-ai bot deleted the sourcery/pull-825 branch September 17, 2021 23:47
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