electionscience / vse-sim

Methods for running simulations to calculate Voter Satisfaction Efficiency (VSE) of various voting systems in various conditions.
https://electionscience.github.io/vse-sim
58 stars 17 forks source link

Import Jameson Quinn's VSE Sim fork (Sourcery refactored) #40

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

Pull Request #39 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/electionscience/vse-sim pull/39/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!

review-notebook-app[bot] commented 1 year ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

sourcery-ai[bot] commented 1 year ago

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 10.56 🙂 24.63 😞 14.07 👎
Method Length 65.75 🙂 83.19 🙂 17.44 👎
Working memory 7.24 🙂 10.51 😞 3.27 👎
Quality 62.04% 🙂 52.64% 🙂 -9.40% 👎
Other metrics Before After Change
Lines 1915 3161 1246
Changed files Quality Before Quality After Quality Change
dataClasses.py 78.68% ⭐ 77.23% ⭐ -1.45% 👎
methods.py 46.23% 😞 43.42% 😞 -2.81% 👎
mydecorators.py 78.84% ⭐ 79.97% ⭐ 1.13% 👍
stratFunctions.py 83.12% ⭐ 90.12% ⭐ 7.00% 👍
voterModels.py 74.14% 🙂 75.00% 🙂 0.86% 👍
vse.py 59.95% 🙂 25.87% 😞 -34.08% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
methods.py V321.stratBallotFor 52 ⛔ 469 ⛔ 5.23% ⛔ Refactor to reduce nesting. Try splitting into smaller methods
vse.py threeRoundResults 39 ⛔ 1126 ⛔ 34 ⛔ 6.32% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
methods.py makeSTARMethod 157 ⛔ 1284 ⛔ 16 ⛔ 7.41% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
methods.py makeScoreMethod 54 ⛔ 829 ⛔ 15 😞 11.06% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
methods.py V321.results 11 🙂 342 ⛔ 16 ⛔ 32.45% 😞 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!