Skip to content

Conversation

@sourcery-ai
Copy link
Contributor

@sourcery-ai sourcery-ai bot commented Jan 28, 2022

Pull Request #19 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 spectral-slope-functions branch, then run:

git fetch origin sourcery/spectral-slope-functions
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot force-pushed the sourcery/spectral-slope-functions branch from 75cc238 to b4c6024 Compare January 28, 2022 15:39
methodlist = ["time_varying", "stationary"]
if method not in methodlist:
if method in ["stationary_levels", "Stationary_Levels"]:
if method in {"stationary_levels", "Stationary_Levels"}:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function loudness_from_wav refactored with the following changes:

  • Use set when checking membership of a collection of literals (collection-into-set)
  • Simplify conditional into switch-like form (switch)

@sourcery-ai
Copy link
Contributor Author

sourcery-ai bot commented Jan 28, 2022

Sourcery Code Quality Report

Merging this PR leaves code quality unchanged.

Quality metrics Before After Change
Complexity 10.76 🙂 10.76 🙂 0.00
Method Length 75.62 🙂 75.62 🙂 0.00
Working memory 12.16 😞 12.16 😞 0.00
Quality 48.71% 😞 48.71% 😞 0.00%
Other metrics Before After Change
Lines 266 266 0
Changed files Quality Before Quality After Quality Change
soundscapy/analysis.py 48.71% 😞 48.71% 😞 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
soundscapy/analysis.py loudness_from_wav 20 😞 257 ⛔ 13 😞 31.83% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
soundscapy/analysis.py spectrogram_2ch 8 ⭐ 214 ⛔ 16 ⛔ 40.56% 😞 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!

@MitchellAcoustics MitchellAcoustics merged commit db6e364 into spectral-slope-functions Jan 28, 2022
@MitchellAcoustics MitchellAcoustics deleted the sourcery/spectral-slope-functions branch January 28, 2022 15:40
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