Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove JuggleError #367

Merged
merged 2 commits into from
Nov 19, 2021
Merged

Remove JuggleError #367

merged 2 commits into from
Nov 19, 2021

Conversation

amolenaar
Copy link
Member

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes

What is the current behavior?

When two constraints are in conflict, an exception is raised (JuggleError) and the solver stays in an undetermined state.

Issue Number: N/A

What is the new behavior?

Instead of raising an exception, there's a cap on how many times a constraint may be resolved. This cap is configurable (16 by default).

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

For normal cases this will not make a difference. It will save us some unexpected errors. Alternatively we should handle the exceptions ourselves (in Gaphor). There's not much a user can do, so we could just as well stop resolving.

This is a simpler solution that introducing a completely new solver (#342).

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 14, 2021

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.80 ⭐ 0.64 ⭐ -0.16 👍
Method Length 35.13 ⭐ 35.95 ⭐ 0.82 👎
Working memory 6.07 ⭐ 5.96 ⭐ -0.11 👍
Quality 82.43% 82.84% 0.41% 👍
Other metrics Before After Change
Lines 334 326 -8
Changed files Quality Before Quality After Quality Change
gaphas/solver/init.py % % %
gaphas/solver/solver.py 87.81% ⭐ 89.28% ⭐ 1.47% 👍
tests/test_solver.py 79.14% ⭐ 79.08% ⭐ -0.06% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
tests/test_solver.py test_minimal_size_constraint 0 ⭐ 126 😞 8 🙂 69.91% 🙂 Try splitting into smaller methods

Legend and Explanation

The emojis denote the absolute quality of the code:

  • ⭐ excellent
  • 🙂 good
  • 😞 poor
  • ⛔ very poor

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!

@amolenaar amolenaar merged commit 69e1d01 into master Nov 19, 2021
@amolenaar amolenaar deleted the no-juggle-error branch November 19, 2021 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants