Music-Discord-Bot icon indicating copy to clipboard operation
Music-Discord-Bot copied to clipboard

Speed up adding tracks from playlist (Sourcery refactored)

Open sourcery-ai[bot] opened this issue 1 year ago β€’ 1 comments

Pull Request #20 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/Darkempire78/Music-Discord-Bot pull/20/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[bot] avatar Jan 03 '23 06:01 sourcery-ai[bot]

Sourcery Code Quality Report

βœ… Β Merging this PR will increase code quality in the affected files by 0.01%.

Quality metrics Before After Change
Complexity 14.41 πŸ™‚ 13.60 πŸ™‚ -0.81 πŸ‘
Method Length 137.36 😞 137.82 😞 0.46 πŸ‘Ž
Working memory 11.87 😞 11.71 😞 -0.16 πŸ‘
Quality 43.86% 😞 43.87% 😞 0.01% πŸ‘
Other metrics Before After Change
Lines 517 559 42
Changed files Quality Before Quality After Quality Change
Cogs/events.py 42.31% 😞 42.95% 😞 0.64% πŸ‘
Cogs/play.py 54.94% πŸ™‚ 55.23% πŸ™‚ 0.29% πŸ‘
Cogs/skip.py 48.43% 😞 48.45% 😞 0.02% πŸ‘
Tools/addTrack.py 8.87% β›” 12.58% β›” 3.71% πŸ‘

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

File Function Complexity Length Working Memory Quality Recommendation
Tools/addTrack.py addTrack 31 😞 723 β›” 21 β›” 12.58% β›” Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
Cogs/events.py EventsCog.on_command_error 16 πŸ™‚ 483 β›” 15 😞 27.57% 😞 Try splitting into smaller methods. Extract out complex expressions
Cogs/events.py EventsCog.on_voice_state_update 17 πŸ™‚ 244 β›” 14 😞 33.31% 😞 Try splitting into smaller methods. Extract out complex expressions
Cogs/play.py CogPlay.play 24 😞 277 β›” 10 😞 33.49% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
Cogs/skip.py CogSkip.skip 8 ⭐ 299 β›” 14 😞 38.78% 😞 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!

sourcery-ai[bot] avatar Jan 03 '23 06:01 sourcery-ai[bot]