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

Move logic out of canvas #138

Merged
merged 18 commits into from
Oct 27, 2020
Merged

Move logic out of canvas #138

merged 18 commits into from
Oct 27, 2020

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Oct 24, 2020

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?

Item instances contain a reference to their Canvas

Issue Number: N/A

What is the new behavior?

  • Item still has a canvas reference, but it's not exposed.
  • Item.normalize() is gone.
  • The update process is completely handled by the View.
  • Segment now depends on a canvas, not on View.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 25, 2020

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 1.11 ⭐ 1.11 ⭐ 0.00
Method Length 44.39 ⭐ 45.23 ⭐ 0.84 👎
Working memory 5.46 ⭐ 5.52 ⭐ 0.06 👎
Quality 87.50% 87.26% -0.24% 👎
Other metrics Before After Change
Lines 4803 4582 -221
Changed files Quality Before Quality After Quality Change
examples/demo.py 88.75% ⭐ 88.75% ⭐ 0.00%
gaphas/aspect.py 93.88% ⭐ 94.02% ⭐ 0.14% 👍
gaphas/canvas.py 93.38% ⭐ 93.98% ⭐ 0.60% 👍
gaphas/connections.py 84.12% ⭐ 84.31% ⭐ 0.19% 👍
gaphas/connector.py 93.52% ⭐ 93.71% ⭐ 0.19% 👍
gaphas/guide.py 84.61% ⭐ 84.53% ⭐ -0.08% 👎
gaphas/item.py 90.37% ⭐ 91.49% ⭐ 1.12% 👍
gaphas/segment.py 76.27% ⭐ 76.48% ⭐ 0.21% 👍
gaphas/tool.py 83.91% ⭐ 83.92% ⭐ 0.01% 👍
gaphas/view/gtkview.py 80.61% ⭐ 80.59% ⭐ -0.02% 👎
gaphas/view/view.py 90.39% ⭐ 90.44% ⭐ 0.05% 👍
tests/conftest.py 91.33% ⭐ 91.34% ⭐ 0.01% 👍
tests/test_canvas.py 81.63% ⭐ 81.69% ⭐ 0.06% 👍
tests/test_element.py 84.64% ⭐ 83.81% ⭐ -0.83% 👎
tests/test_guide.py 82.09% ⭐ 81.97% ⭐ -0.12% 👎
tests/test_line.py 87.22% ⭐ 87.22% ⭐ 0.00%
tests/test_segment.py 79.45% ⭐ 79.44% ⭐ -0.01% 👎
tests/test_undo.py 77.72% ⭐ 76.67% ⭐ -1.05% 👎
tests/test_view.py 88.62% ⭐ 88.70% ⭐ 0.08% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
examples/demo.py create_window 9 🙂 861 ⛔ 15 😞 33.08% 😞 Try splitting into smaller methods. Extract out complex expressions
gaphas/view/gtkview.py GtkView.update_back_buffer 14 🙂 224 ⛔ 12 😞 39.89% 😞 Try splitting into smaller methods. Extract out complex expressions
gaphas/view/gtkview.py GtkView.update_adjustments 6 ⭐ 206 ⛔ 15 😞 44.15% 😞 Try splitting into smaller methods. Extract out complex expressions
gaphas/view/gtkview.py GtkView.get_handle_at_point 18 🙂 149 😞 9 🙂 48.65% 😞 Try splitting into smaller methods
gaphas/item.py Line._update_orthogonal_constraints 11 🙂 142 😞 12 😞 49.54% 😞 Try splitting into smaller methods. Extract out complex expressions

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!

Let us know what you think of it by mentioning @sourcery-ai in a comment.

@amolenaar amolenaar changed the title Items without canvas Move logic out of canvas Oct 25, 2020
@amolenaar amolenaar merged commit 3bc554f into master Oct 27, 2020
@amolenaar amolenaar deleted the items-without-canvas branch October 27, 2020 20:23
@danyeaw danyeaw added the chore label Nov 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants