drf-addons icon indicating copy to clipboard operation
drf-addons copied to clipboard

Refactor `else` / `elif` when `if` block has a `raise` statement

Open karansthr opened this issue 3 years ago β€’ 1 comments

Refactor else / elif when if block has a raise statement (#1)

Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>

karansthr avatar Oct 05 '21 03:10 karansthr

Sourcery Code Quality Report

❌  Merging this PR will decrease code quality in the affected files by 0.66%.

Quality metrics Before After Change
Complexity 11.14 πŸ™‚ 11.64 πŸ™‚ 0.50 πŸ‘Ž
Method Length 51.62 ⭐ 51.62 ⭐ 0.00
Working memory 8.18 πŸ™‚ 8.22 πŸ™‚ 0.04 πŸ‘Ž
Quality 63.06% πŸ™‚ 62.40% πŸ™‚ -0.66% πŸ‘Ž
Other metrics Before After Change
Lines 399 399 0
Changed files Quality Before Quality After Quality Change
drfaddons/auth.py 70.96% πŸ™‚ 70.66% πŸ™‚ -0.30% πŸ‘Ž
drfaddons/utils.py 61.13% πŸ™‚ 60.34% πŸ™‚ -0.79% πŸ‘Ž

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

File Function Complexity Length Working Memory Quality Recommendation
drfaddons/utils.py send_message 25 😞 257 β›” 11 😞 31.86% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
drfaddons/utils.py paginate_data 10 πŸ™‚ 115 πŸ™‚ 12 😞 53.67% πŸ™‚ Extract out complex expressions
drfaddons/utils.py groupby_queryset_with_fields 10 πŸ™‚ 79 πŸ™‚ 10 😞 62.29% πŸ™‚ 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 05 '21 03:10 sourcery-ai[bot]