electionscience / vote.electionscience.org

Down with Plurality-Based Web Polling!
https://vote.electionscience.org
GNU General Public License v3.0
36 stars 33 forks source link

Sourcery refactored main branch #187

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

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^

Help us improve this pull request!

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 80.36 ⛔ 81.09 ⛔ 0.73 👎
Method Length 71.42 🙂 71.14 🙂 -0.28 👍
Working memory 12.30 😞 12.50 😞 0.20 👎
Quality 52.44% 🙂 52.29% 🙂 -0.15% 👎
Other metrics Before After Change
Lines 1762 1728 -34
Changed files Quality Before Quality After Quality Change
approval_frame/forms.py 75.56% ⭐ 72.79% 🙂 -2.77% 👎
approval_frame/views.py 54.67% 🙂 56.00% 🙂 1.33% 👍
approval_frame/middleware/timezone_middleware.py 94.52% ⭐ 89.39% ⭐ -5.13% 👎
approval_frame/scripts/update_user_subscriptions.py 70.25% 🙂 71.86% 🙂 1.61% 👍
approval_polls/models.py 84.73% ⭐ 84.64% ⭐ -0.09% 👎
approval_polls/tests.py 87.14% ⭐ 87.13% ⭐ -0.01% 👎
approval_polls/views.py 18.00% ⛔ 18.29% ⛔ 0.29% 👍
approval_polls/templatetags/filters.py 92.83% ⭐ 94.01% ⭐ 1.18% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
approval_polls/views.py vote 382 ⛔ 1391 ⛔ 26 ⛔ 1.64% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
approval_polls/views.py EditView.post 44 ⛔ 667 ⛔ 24 ⛔ 6.77% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
approval_polls/views.py DetailView.get_context_data 42 ⛔ 402 ⛔ 20 ⛔ 10.38% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
approval_polls/views.py CreateView.post 50 ⛔ 409 ⛔ 16 ⛔ 11.78% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
approval_frame/views.py manageSubscriptions 18 🙂 199 😞 13 😞 36.85% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

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!