tpaviot / ProcessScheduler

A Python package for automatic and optimized resource scheduling
https://processscheduler.github.io/
GNU General Public License v3.0
58 stars 17 forks source link

Review/fixes (Sourcery refactored) #112

Closed sourcery-ai[bot] closed 1 year ago

sourcery-ai[bot] commented 1 year ago

Pull Request #111 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 review/fixes branch, then run:

git fetch origin sourcery/review/fixes
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 increase code quality in the affected files by 0.39%.

Quality metrics Before After Change
Complexity 20.57 😞 19.59 😞 -0.98 👍
Method Length 109.57 🙂 109.61 🙂 0.04 👎
Working memory 10.64 😞 10.68 😞 0.04 👎
Quality 45.88% 😞 46.27% 😞 0.39% 👍
Other metrics Before After Change
Lines 1535 1520 -15
Changed files Quality Before Quality After Quality Change
benchmark/benchmark_logics.py 68.93% 🙂 67.86% 🙂 -1.07% 👎
processscheduler/base.py 83.16% ⭐ 83.11% ⭐ -0.05% 👎
processscheduler/resource.py 66.70% 🙂 67.27% 🙂 0.57% 👍
processscheduler/resource_constraint.py 45.55% 😞 46.46% 😞 0.91% 👍
processscheduler/solver.py 28.65% 😞 29.19% 😞 0.54% 👍
processscheduler/task.py 59.80% 🙂 60.63% 🙂 0.83% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
processscheduler/solver.py SchedulingSolver.__init__ 54 ⛔ 798 ⛔ 16 ⛔ 9.94% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/solver.py SchedulingSolver.solve_optimize_incremental 33 ⛔ 336 ⛔ 16 ⛔ 17.96% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/solver.py SchedulingSolver.build_solution 42 ⛔ 514 ⛔ 12 😞 18.16% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/solver.py SchedulingSolver.solve 31 😞 218 ⛔ 12 😞 29.15% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/resource_constraint.py WorkLoad.__init__ 15 🙂 302 ⛔ 14 😞 32.47% 😞 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!