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
57 stars 17 forks source link

Import Jameson Quinn's VSE Sim fork #39

Open fsargent opened 1 year ago

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.94%.

Quality metrics Before After Change
Complexity 10.56 🙂 25.92 😞 15.36 👎
Method Length 65.75 🙂 84.00 🙂 18.25 👎
Working memory 7.24 🙂 10.57 😞 3.33 👎
Quality 62.04% 🙂 52.10% 🙂 -9.94% 👎
Other metrics Before After Change
Lines 1915 3200 1285
Changed files Quality Before Quality After Quality Change
dataClasses.py 78.68% ⭐ 77.21% ⭐ -1.47% 👎
methods.py 46.23% 😞 42.58% 😞 -3.65% 👎
mydecorators.py 78.84% ⭐ 79.88% ⭐ 1.04% 👍
stratFunctions.py 83.12% ⭐ 88.25% ⭐ 5.13% 👍
voterModels.py 74.14% 🙂 74.78% 🙂 0.64% 👍
vse.py 59.95% 🙂 25.94% 😞 -34.01% 👎

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 40 ⛔ 1131 ⛔ 34 ⛔ 6.01% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
methods.py makeSTARMethod 161 ⛔ 1308 ⛔ 16 ⛔ 7.41% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
methods.py makeScoreMethod 54 ⛔ 881 ⛔ 15 😞 11.05% ⛔ 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!

fsargent commented 1 year ago

@ragconsumer Can you resolve the conflicts so we can merge it?

ragconsumer commented 1 year ago

@ragconsumer Can you resolve the conflicts so we can merge it?

Full disclosure: I have no experience handling pull requests of any appreciable size, and I don't see any options for debugging that would prevent the disaster I anticipate when all the code is combined. The old VSE code was absolutely hideous, and I foresee problems when incorporating anything that was based on it. My approach would be to dump the old code altogether and switch to using only the code on Jameson's branch. I can try resolving the conflicts manually if you want, but I expect something to break. By the way, I'm coding a new version in Julia that should make this obsolete in a few months.

fsargent commented 1 year ago

Honestly whatever you want to do with it sounds good to me. Happy to update the website however you see fit. You're the experts.