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

Refactor toolboxes to reduce duplication #462

Merged
merged 3 commits into from
Oct 4, 2020
Merged

Conversation

danyeaw
Copy link
Member

@danyeaw danyeaw commented Sep 28, 2020

Signed-off-by: Dan Yeaw dan@yeaw.me

The previous toolboxes required the SysML toolbox to repeat many of the definitions from the UML toolbox since many of the tools are repeated. This made it easy for us to update one, and forget to update the other one.

PR Checklist

Please check if your PR fulfills the following requirements:

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?

Duplicated code between the toolboxes.

Issue Number: N/A

What is the new behavior?

A new named tuple is introduced called ToolSection. This allows the SysML toolbox to import whole sections of tools from the UML toolbox.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions bot added the chore Maintenance related PR label Sep 28, 2020
@danyeaw
Copy link
Member Author

danyeaw commented Sep 29, 2020

I have been moving all the toolbox sections to their own packages, still a little work to do here.

Signed-off-by: Dan Yeaw <dan@yeaw.me>
Signed-off-by: Dan Yeaw <dan@yeaw.me>
Signed-off-by: Dan Yeaw <dan@yeaw.me>
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Sep 30, 2020

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 1.18 ⭐ 0.69 ⭐ -0.49 👍
Method Length 110.14 🙂 42.15 ⭐ -67.99 👍
Working memory 29.05 ⛔ 10.54 😞 -18.51 👍
Quality 82.84% 82.78% -0.06% 👎
Other metrics Before After Change
Lines 1218 262 -956
Changed files Quality Before Quality After Quality Change
gaphor/SysML/toolbox.py 33.37% 😞 56.33% 🙂 22.96% 👍
gaphor/UML/toolbox.py 83.12% ⭐ 81.80% ⭐ -1.32% 👎
gaphor/UML/tests/test_diagrampage_tools.py 88.00% ⭐ 88.08% ⭐ 0.08% 👍
gaphor/diagram/diagramtoolbox.py 87.65% ⭐ 77.80% ⭐ -9.85% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
gaphor/UML/tests/test_diagrampage_tools.py test_placement_action 0 59 ⭐ 31 ⛔ 59.41% 🙂 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.

@danyeaw
Copy link
Member Author

danyeaw commented Sep 30, 2020

@sourcery-ai why are all the quality metrics going up, but the overall quality is going down slightly?

@danyeaw
Copy link
Member Author

danyeaw commented Oct 3, 2020

@amolenaar This one is ready 👍

@danyeaw danyeaw merged commit 3121207 into master Oct 4, 2020
@danyeaw danyeaw deleted the chore/refactor-toolbox branch October 4, 2020 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Maintenance related PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant