anibot icon indicating copy to clipboard operation
anibot copied to clipboard

Update helper.py (Sourcery refactored)

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

Pull Request #23 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 patch-1 branch, then run:

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

Help us improve this pull request!

sourcery-ai[bot] avatar Oct 11 '22 18:10 sourcery-ai[bot]

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 15.85 πŸ™‚ 15.48 πŸ™‚ -0.37 πŸ‘
Method Length 133.55 😞 133.00 😞 -0.55 πŸ‘
Working memory 7.83 πŸ™‚ 7.27 πŸ™‚ -0.56 πŸ‘
Quality 46.91% 😞 48.16% 😞 1.25% πŸ‘
Other metrics Before After Change
Lines 375 467 92
Changed files Quality Before Quality After Quality Change
anibot/utils/helper.py 46.91% 😞 48.16% 😞 1.25% πŸ‘

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

File Function Complexity Length Working Memory Quality Recommendation
anibot/utils/helper.py get_btns 30 😞 655 β›” 15 😞 18.09% β›” Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
anibot/utils/helper.py control_user 30 😞 239 β›” 23.38% β›” Refactor to reduce nesting. Try splitting into smaller methods
anibot/utils/helper.py media_to_image 16 πŸ™‚ 346 β›” 12 😞 33.47% 😞 Try splitting into smaller methods. Extract out complex expressions
anibot/utils/helper.py check_user 23 😞 142 😞 41.18% 😞 Refactor to reduce nesting. Try splitting into smaller methods
anibot/utils/helper.py get_auth_btns 12 πŸ™‚ 176 😞 13 😞 43.68% 😞 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 Oct 11 '22 18:10 sourcery-ai[bot]