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

🔧 Make mypy and doc string linters opt out instead of opt in #1173

Merged
merged 7 commits into from
Nov 9, 2022

Conversation

s-weigand
Copy link
Member

@s-weigand s-weigand commented Nov 7, 2022

Changed the mypy and flake8-docs pre-commit hooks to be opt out instead of opt in and fixed some docstring and typing issues along the way.

Change summary

Checklist

  • ✔️ Passing the tests (mandatory for all PR's)
  • 🚧 Added changes to changelog (mandatory for all PR's)
  • 👌 Closes issue (mandatory for ✨ feature and 🩹 bug fix PR's)

Closes issues

closes #1001

@s-weigand s-weigand requested review from jsnel, joernweissenborn and a team as code owners November 7, 2022 02:37
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 7, 2022

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 4.30 ⭐ 4.29 ⭐ -0.01 👍
Method Length 74.88 🙂 71.14 🙂 -3.74 👍
Working memory 7.75 🙂 7.75 🙂 0.00
Quality 67.16% 🙂 67.16% 🙂 0.00%
Other metrics Before After Change
Lines 1637 1741 104
Changed files Quality Before Quality After Quality Change
benchmark/benchmarks/unit/analysis/bench_optimize.py 58.05% 🙂 58.05% 🙂 0.00%
glotaran/init.py 92.05% ⭐ 92.05% ⭐ 0.00%
glotaran/builtin/io/init.py % % %
glotaran/builtin/io/netCDF/init.py % % %
glotaran/builtin/io/netCDF/netCDF.py 89.94% ⭐ 89.77% ⭐ -0.17% 👎
glotaran/builtin/io/sdt/init.py % % %
glotaran/builtin/io/sdt/sdt_file_reader.py 36.78% 😞 36.78% 😞 0.00%
glotaran/builtin/io/yml/init.py % % %
glotaran/builtin/io/yml/utils.py 83.36% ⭐ 82.68% ⭐ -0.68% 👎
glotaran/builtin/io/yml/yml.py 72.30% 🙂 72.28% 🙂 -0.02% 👎
glotaran/builtin/megacomplexes/coherent_artifact/test/test_coherent_artifact.py 46.35% 😞 46.35% 😞 0.00%
glotaran/builtin/megacomplexes/decay/test/test_decay_megacomplex.py 55.92% 🙂 55.92% 🙂 0.00%
glotaran/io/init.py % % %
glotaran/io/interface.py 88.22% ⭐ 88.22% ⭐ 0.00%
glotaran/io/prepare_dataset.py 65.64% 🙂 65.63% 🙂 -0.01% 👎
glotaran/model/model.py 77.55% ⭐ 77.54% ⭐ -0.01% 👎
glotaran/testing/simulated_data/sequential_spectral_decay.py 62.34% 🙂 62.34% 🙂 0.00%
glotaran/typing/protocols.py 81.59% ⭐ 81.44% ⭐ -0.15% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
glotaran/builtin/io/sdt/sdt_file_reader.py SdtDataIo.load_dataset 15 🙂 267 ⛔ 12 😞 36.78% 😞 Try splitting into smaller methods. Extract out complex expressions
glotaran/builtin/megacomplexes/coherent_artifact/test/test_coherent_artifact.py test_coherent_artifact 6 ⭐ 500 ⛔ 9 🙂 46.35% 😞 Try splitting into smaller methods
glotaran/builtin/io/yml/yml.py YmlProjectIo.save_model 15 🙂 117 🙂 13 😞 47.50% 😞 Extract out complex expressions
glotaran/builtin/megacomplexes/decay/test/test_decay_megacomplex.py test_kinetic_model 4 ⭐ 325 ⛔ 9 🙂 50.55% 🙂 Try splitting into smaller methods
benchmark/benchmarks/unit/analysis/bench_optimize.py BenchmarkOptimize.setup 4 ⭐ 180 😞 12 😞 52.42% 🙂 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!

@github-actions
Copy link
Contributor

github-actions bot commented Nov 7, 2022

Binder 👈 Launch a binder notebook on branch s-weigand/pyglotaran/mypy-opt-out

@codecov
Copy link

codecov bot commented Nov 7, 2022

Codecov Report

Base: 87.6% // Head: 87.6% // Increases project coverage by +0.0% 🎉

Coverage data is based on head (a880ed9) compared to base (ece973f).
Patch coverage: 60.0% of modified lines in pull request are covered.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1173   +/-   ##
=====================================
  Coverage   87.6%   87.6%           
=====================================
  Files        103     103           
  Lines       4896    4898    +2     
  Branches     806     806           
=====================================
+ Hits        4289    4291    +2     
  Misses       489     489           
  Partials     118     118           
Impacted Files Coverage Δ
glotaran/__init__.py 100.0% <ø> (ø)
glotaran/builtin/io/netCDF/netCDF.py 100.0% <ø> (ø)
glotaran/builtin/io/sdt/sdt_file_reader.py 62.1% <0.0%> (ø)
glotaran/builtin/io/yml/yml.py 88.4% <ø> (ø)
glotaran/io/__init__.py 100.0% <ø> (ø)
glotaran/io/interface.py 100.0% <ø> (ø)
glotaran/io/prepare_dataset.py 65.3% <0.0%> (ø)
...esting/simulated_data/sequential_spectral_decay.py 100.0% <ø> (ø)
glotaran/typing/protocols.py 0.0% <ø> (ø)
glotaran/builtin/io/yml/utils.py 100.0% <100.0%> (ø)
... 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.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 7, 2022

This pull request fixes 1 alert when merging b9cb524 into ece973f - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 7, 2022

This pull request fixes 1 alert when merging 4fffe9c into ece973f - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`

Copy link
Member

@jsnel jsnel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small stylistic improvements.

tox.ini Outdated Show resolved Hide resolved
glotaran/builtin/io/netCDF/netCDF.py Outdated Show resolved Hide resolved
glotaran/builtin/io/sdt/sdt_file_reader.py Outdated Show resolved Hide resolved
glotaran/builtin/io/sdt/sdt_file_reader.py Outdated Show resolved Hide resolved
glotaran/builtin/io/sdt/sdt_file_reader.py Outdated Show resolved Hide resolved
glotaran/builtin/io/yml/utils.py Outdated Show resolved Hide resolved
Co-authored-by: Joris Snellenburg <jsnel@users.noreply.github.com>
@s-weigand s-weigand requested a review from jsnel November 9, 2022 18:51
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 9, 2022

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 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Nov 9, 2022

This pull request fixes 1 alert when merging a880ed9 into ece973f - view on LGTM.com

fixed alerts:

  • 1 for Comparison using is when operands support `__eq__`

Copy link
Member

@jsnel jsnel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for incorporating the suggested changes! LGTM.

@jsnel jsnel merged commit 53bb3b9 into glotaran:main Nov 9, 2022
@jsnel jsnel deleted the mypy-opt-out branch November 9, 2022 21:35
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.

🔧 Make mypy and doc string linters opt out instead of opt in
2 participants