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

🩹 Fix coherent artifact crash for index dependent models (Sourcery refactored) #810

Closed
wants to merge 7 commits into from

Conversation

sourcery-ai[bot]
Copy link
Contributor

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

Pull Request #808 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/808/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 sourcery-ai bot requested review from joernweissenborn, jsnel and a team as code owners September 11, 2021 21:09
@sourcery-ai sourcery-ai bot requested a review from s-weigand September 11, 2021 21:09
@github-actions
Copy link
Contributor

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

If the dataset_model was index_dependent, CoherentArtifactMegacomplex.finalize_data did crash because it tried cast data of dimensions (global_dimension, model_dimension, "coherent_artifact_order") to the dimensions (model_dimension, "coherent_artifact_order")
@sourcery-ai sourcery-ai bot force-pushed the sourcery/pull-808 branch 2 times, most recently from 46497b4 to 3db633d Compare September 11, 2021 21:12
@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Sep 11, 2021

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 6.49 ⭐ 6.49 ⭐ 0.00
Method Length 68.67 🙂 68.67 🙂 0.00
Working memory 9.68 🙂 9.68 🙂 0.00
Quality 63.27% 🙂 63.27% 🙂 0.00%
Other metrics Before After Change
Lines 1505 1505 0
Changed files Quality Before Quality After Quality Change
glotaran/analysis/problem.py 80.36% ⭐ 80.36% ⭐ 0.00%
glotaran/analysis/problem_grouped.py 57.20% 🙂 57.20% 🙂 0.00%
glotaran/analysis/problem_ungrouped.py 67.75% 🙂 67.75% 🙂 0.00%
glotaran/analysis/simulation.py 64.20% 🙂 64.20% 🙂 0.00%
glotaran/analysis/test/test_optimization.py 34.60% 😞 34.60% 😞 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/analysis/test/test_optimization.py test_optimization 19 😞 509 ⛔ 15 😞 25.13% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
glotaran/analysis/problem_grouped.py GroupedProblem._append_to_grouped_bag 12 🙂 269 ⛔ 23 ⛔ 29.09% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/analysis/problem_ungrouped.py UngroupedProblem._calculate_residual 13 🙂 214 ⛔ 12 😞 41.40% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/analysis/problem_grouped.py GroupedProblem.init_bag 10 🙂 174 😞 16 ⛔ 41.86% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/analysis/problem.py Problem._add_weight 15 🙂 134 😞 11 😞 48.74% 😞 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!

@sonarcloud
Copy link

sonarcloud bot commented Sep 11, 2021

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 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov
Copy link

codecov bot commented Sep 11, 2021

Codecov Report

Merging #810 (619bd4f) into staging (9892b6e) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##           staging    #810   +/-   ##
=======================================
  Coverage     84.5%   84.5%           
=======================================
  Files           75      75           
  Lines         4198    4201    +3     
  Branches       756     757    +1     
=======================================
+ Hits          3550    3553    +3     
  Misses         515     515           
  Partials       133     133           
Impacted Files Coverage Δ
glotaran/analysis/problem.py 90.9% <100.0%> (ø)
glotaran/analysis/problem_grouped.py 96.0% <100.0%> (ø)
glotaran/analysis/problem_ungrouped.py 93.8% <100.0%> (ø)
glotaran/analysis/simulation.py 82.9% <100.0%> (ø)
...coherent_artifact/coherent_artifact_megacomplex.py 73.5% <100.0%> (+1.5%) ⬆️
glotaran/model/dataset_model.py 82.0% <100.0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9892b6e...619bd4f. Read the comment docs.

@github-actions
Copy link
Contributor

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]       [619bd4f4]
     <v0.4.0>                   
-      43.1±0.3ms       31.7±0.2ms     0.74  BenchmarkOptimize.time_optimize(False, False, False)
-       246±0.4ms       37.4±0.7ms     0.15  BenchmarkOptimize.time_optimize(False, False, True)
-      63.1±0.4ms       52.6±0.3ms     0.83  BenchmarkOptimize.time_optimize(False, True, False)
       65.1±0.2ms       57.1±0.8ms    ~0.88  BenchmarkOptimize.time_optimize(False, True, True)
       43.0±0.3ms       41.6±0.5ms     0.97  BenchmarkOptimize.time_optimize(True, False, False)
-       246±0.8ms        47.1±30ms     0.19  BenchmarkOptimize.time_optimize(True, False, True)
       63.0±0.3ms       63.9±0.3ms     1.01  BenchmarkOptimize.time_optimize(True, True, False)
       65.0±0.3ms        86.8±30ms    ~1.34  BenchmarkOptimize.time_optimize(True, True, True)
             179M             180M     1.00  IntegrationTwoDatasets.peakmem_create_result
             197M             199M     1.01  IntegrationTwoDatasets.peakmem_optimize
-         205±1ms          164±3ms     0.80  IntegrationTwoDatasets.time_create_result
-      4.29±0.02s        1.51±0.1s     0.35  IntegrationTwoDatasets.time_optimize

@sourcery-ai sourcery-ai bot closed this Sep 11, 2021
@s-weigand
Copy link
Member

See #811

@s-weigand s-weigand deleted the sourcery/pull-808 branch April 3, 2022 20:15
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.

1 participant