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

Sourcery refactored main branch #1848

Merged
merged 1 commit into from
Dec 10, 2021
Merged

Sourcery refactored main branch #1848

merged 1 commit into from
Dec 10, 2021

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented May 4, 2021

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

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 main branch, then run:

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

setup.py Outdated Show resolved Hide resolved
examples/gridding/Inverse_Distance_Verification.py Outdated Show resolved Hide resolved
src/metpy/xarray.py Show resolved Hide resolved
src/metpy/xarray.py Show resolved Hide resolved
src/metpy/xarray.py Show resolved Hide resolved
src/metpy/io/nexrad.py Show resolved Hide resolved
src/metpy/io/station_data.py Show resolved Hide resolved
src/metpy/io/station_data.py Outdated Show resolved Hide resolved
src/metpy/plots/_mpl.py Show resolved Hide resolved
src/metpy/plots/_util.py Show resolved Hide resolved
src/metpy/plots/declarative.py Show resolved Hide resolved
src/metpy/plots/declarative.py Show resolved Hide resolved
src/metpy/plots/declarative.py Show resolved Hide resolved
src/metpy/plots/declarative.py Outdated Show resolved Hide resolved
src/metpy/plots/declarative.py Outdated Show resolved Hide resolved
tests/calc/test_thermo.py Outdated Show resolved Hide resolved
tests/interpolate/test_one_dimension.py Outdated Show resolved Hide resolved
tests/interpolate/test_slices.py Outdated Show resolved Hide resolved
tests/plots/test_util.py Outdated Show resolved Hide resolved
tools/nexrad_msgs/parse_spec.py Show resolved Hide resolved
@dopplershift
Copy link
Member

Testing out another AI-driven tool. We'll see how this goes.

@sourcery-ai sourcery-ai bot force-pushed the sourcery/main branch 3 times, most recently from 8fec6c3 to fd834cc Compare May 4, 2021 18:12
@sourcery-ai
Copy link
Author

sourcery-ai bot commented May 4, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 5.56 ⭐ 5.45 ⭐ -0.11 👍
Method Length 74.04 🙂 73.94 🙂 -0.10 👍
Working memory 13.38 😞 13.38 😞 0.00
Quality 61.99% 🙂 62.10% 🙂 0.11% 👍
Other metrics Before After Change
Lines 15165 15134 -31
Changed files Quality Before Quality After Quality Change
setup.py 71.86% 🙂 71.86% 🙂 0.00%
examples/gridding/Inverse_Distance_Verification.py 33.59% 😞 33.59% 😞 0.00%
src/metpy/xarray.py 55.26% 🙂 55.36% 🙂 0.10% 👍
src/metpy/_vendor/xarray.py 67.16% 🙂 68.79% 🙂 1.63% 👍
src/metpy/calc/basic.py 60.78% 🙂 60.61% 🙂 -0.17% 👎
src/metpy/calc/cross_sections.py 70.22% 🙂 70.52% 🙂 0.30% 👍
src/metpy/calc/thermo.py 57.12% 🙂 57.12% 🙂 0.00%
src/metpy/calc/tools.py 47.12% 😞 47.46% 😞 0.34% 👍
src/metpy/interpolate/geometry.py 69.12% 🙂 68.97% 🙂 -0.15% 👎
src/metpy/interpolate/slices.py 57.93% 🙂 57.92% 🙂 -0.01% 👎
src/metpy/io/nexrad.py 58.68% 🙂 58.62% 🙂 -0.06% 👎
src/metpy/io/station_data.py 61.52% 🙂 61.84% 🙂 0.32% 👍
src/metpy/plots/_mpl.py 48.88% 😞 47.97% 😞 -0.91% 👎
src/metpy/plots/_util.py 61.69% 🙂 61.80% 🙂 0.11% 👍
src/metpy/plots/declarative.py 65.36% 🙂 66.57% 🙂 1.21% 👍
tests/calc/test_calc_tools.py 72.47% 🙂 72.50% 🙂 0.03% 👍
tests/calc/test_thermo.py 69.23% 🙂 69.19% 🙂 -0.04% 👎
tests/interpolate/test_one_dimension.py 78.07% ⭐ 78.07% ⭐ 0.00%
tests/interpolate/test_slices.py 61.20% 🙂 61.20% 🙂 0.00%
tests/plots/test_util.py 81.01% ⭐ 81.15% ⭐ 0.14% 👍
tools/nexrad_msgs/parse_spec.py 65.97% 🙂 66.23% 🙂 0.26% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
src/metpy/calc/tools.py _get_bound_pressure_height 45 ⛔ 292 ⛔ 28 ⛔ 9.15% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/metpy/io/nexrad.py Level3File.__init__ 31 😞 627 ⛔ 22 ⛔ 12.16% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/metpy/plots/declarative.py PlotObs._build 36 ⛔ 438 ⛔ 17 ⛔ 14.22% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
src/metpy/io/nexrad.py Level3File._unpack_packet_special_graphic_symbol 18 🙂 335 ⛔ 23 ⛔ 22.00% ⛔ Try splitting into smaller methods. Extract out complex expressions
src/metpy/xarray.py preprocess_and_wrap 41 ⛔ 249 ⛔ 12 😞 23.61% ⛔ 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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@dopplershift
Copy link
Member

Ok, I rebased this and cut it down to just the changes I like. Once I figure out why tests are failing (I think the same as #2244) this can go in.

@dopplershift dopplershift merged commit 8b01e1f into main Dec 10, 2021
@dopplershift dopplershift deleted the sourcery/main branch December 10, 2021 19:52
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