tpaviot / ProcessScheduler

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

Preliminary work for JSON import/export #102

Closed tpaviot closed 3 years ago

tpaviot commented 3 years ago

JSON import/export requires a few changes. Constraint instances are added to the current context in the same way than Tasks or Resources. That means it's no use anymore to explicitly add_constraint.

codecov-commenter commented 3 years ago

Codecov Report

Merging #102 (80e72b0) into master (2febe48) will increase coverage by 0.45%. The diff coverage is 97.64%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #102      +/-   ##
==========================================
+ Coverage   95.11%   95.56%   +0.45%     
==========================================
  Files          35       38       +3     
  Lines        3889     4059     +170     
==========================================
+ Hits         3699     3879     +180     
+ Misses        190      180      -10     
Impacted Files Coverage Δ
processscheduler/context.py 86.20% <83.33%> (-2.69%) :arrow_down:
processscheduler/resource.py 96.55% <88.88%> (-0.92%) :arrow_down:
processscheduler/first_order_logic.py 97.29% <91.66%> (+0.15%) :arrow_up:
processscheduler/base.py 96.77% <92.85%> (+3.44%) :arrow_up:
processscheduler/task.py 98.16% <92.85%> (-0.88%) :arrow_down:
processscheduler/resource_constraint.py 94.69% <94.28%> (-1.15%) :arrow_down:
processscheduler/solver.py 96.35% <96.77%> (+0.03%) :arrow_up:
test/test_json_io.py 97.05% <97.05%> (ø)
test/test_util.py 97.82% <97.82%> (ø)
processscheduler/json_io.py 99.13% <99.13%> (ø)
... and 24 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2febe48...80e72b0. Read the comment docs.

sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.31%.

Quality metrics Before After Change
Complexity 5.82 ⭐ 6.09 ⭐ 0.27 👎
Method Length 67.17 🙂 65.27 🙂 -1.90 👍
Working memory 8.99 🙂 8.89 🙂 -0.10 👍
Quality 66.96% 🙂 67.27% 🙂 0.31% 👍
Other metrics Before After Change
Lines 5933 5932 -1
Changed files Quality Before Quality After Quality Change
benchmark/benchmark_mixed.py 40.44% 😞 39.03% 😞 -1.41% 👎
benchmark/benchmark_n_queens.py 42.04% 😞 42.27% 😞 0.23% 👍
processscheduler/init.py 83.30% ⭐ 82.67% ⭐ -0.63% 👎
processscheduler/base.py 90.54% ⭐ 86.27% ⭐ -4.27% 👎
processscheduler/constraint.py 83.54% ⭐ 85.17% ⭐ 1.63% 👍
processscheduler/context.py 91.51% ⭐ 90.65% ⭐ -0.86% 👎
processscheduler/first_order_logic.py 93.07% ⭐ 92.95% ⭐ -0.12% 👎
processscheduler/objective.py 84.41% ⭐ 84.41% ⭐ 0.00%
processscheduler/problem.py 72.23% 🙂 71.51% 🙂 -0.72% 👎
processscheduler/resource.py 71.93% 🙂 69.67% 🙂 -2.26% 👎
processscheduler/resource_constraint.py 48.03% 😞 46.56% 😞 -1.47% 👎
processscheduler/solution.py 37.31% 😞 33.71% 😞 -3.60% 👎
processscheduler/solver.py 33.14% 😞 32.88% 😞 -0.26% 👎
processscheduler/task.py 66.19% 🙂 65.75% 🙂 -0.44% 👎
processscheduler/task_constraint.py 74.23% 🙂 74.23% 🙂 0.00%
test/test_buffer.py 69.23% 🙂 72.99% 🙂 3.76% 👍
test/test_cost.py 79.83% ⭐ 79.89% ⭐ 0.06% 👍
test/test_cumulative.py 77.71% ⭐ 77.91% ⭐ 0.20% 👍
test/test_dynamic_resource.py 69.51% 🙂 70.26% 🙂 0.75% 👍
test/test_gantt.py 81.45% ⭐ 81.58% ⭐ 0.13% 👍
test/test_indicator.py 74.21% 🙂 74.61% 🙂 0.40% 👍
test/test_optional_constraint.py 79.60% ⭐ 81.19% ⭐ 1.59% 👍
test/test_optional_task.py 73.90% 🙂 74.63% 🙂 0.73% 👍
test/test_resource_tasks_distance.py 58.93% 🙂 60.89% 🙂 1.96% 👍
test/test_resource_unavailable.py 76.27% ⭐ 79.85% ⭐ 3.58% 👍
test/test_schedule_n_task_in_time_interval.py 70.34% 🙂 73.06% 🙂 2.72% 👍
test/test_solver.py 75.30% ⭐ 75.64% ⭐ 0.34% 👍
test/test_task.py 83.11% ⭐ 83.65% ⭐ 0.54% 👍
test/test_workload.py 74.85% 🙂 76.88% ⭐ 2.03% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
processscheduler/solution.py SchedulingSolution.render_gantt_matplotlib 50 ⛔ 665 ⛔ 22 ⛔ 6.30% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/solver.py SchedulingSolver.__init__ 49 ⛔ 608 ⛔ 13 😞 14.71% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/solver.py SchedulingSolver.build_solution 42 ⛔ 408 ⛔ 12 😞 18.96% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/solver.py SchedulingSolver.solve_optimize_incremental 29 😞 287 ⛔ 15 😞 22.41% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
processscheduler/solution.py SchedulingSolution.render_gantt_plotly 23 😞 284 ⛔ 17 ⛔ 23.86% ⛔ Refactor to reduce nesting. 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!