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

Hide New Package menu unless package selected #1959

Merged
merged 1 commit into from
Dec 26, 2022
Merged

Conversation

danyeaw
Copy link
Member

@danyeaw danyeaw commented Dec 26, 2022

Fixes #1952 which is an assertion error while creating a package that is nested under a non-package item.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

The New Package option was always visible on the right click menu.

Issue Number: #1952

What is the new behavior?

The New Package option is disabled unless you are right-clicking on a package.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@github-actions github-actions bot added the python Pull requests that update Python code label Dec 26, 2022
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 26, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.90 ⭐ 3.05 ⭐ 0.15 👎
Method Length 75.71 🙂 76.00 🙂 0.29 👎
Working memory 6.80 🙂 6.80 🙂 0.00
Quality 73.50% 🙂 73.23% 🙂 -0.27% 👎
Other metrics Before After Change
Lines 325 326 1
Changed files Quality Before Quality After Quality Change
gaphor/ui/namespace.py 73.50% 🙂 73.23% 🙂 -0.27% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
gaphor/ui/namespace.py popup_model 9 🙂 213 ⛔ 8 🙂 52.95% 🙂 Try splitting into smaller methods
gaphor/ui/namespace.py Namespace.open 4 ⭐ 187 😞 8 🙂 59.72% 🙂 Try splitting into smaller methods
gaphor/ui/namespace.py Namespace._on_show_popup 3 ⭐ 127 😞 10 😞 62.53% 🙂 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!

Help us improve this quality report!

@danyeaw danyeaw added the fix A fix for a bug label Dec 26, 2022
Fixes #1952 which was an assertion error while creating a new package.
Previously, the New Package option was always visible on the right click
menu. This changes the behavior so that you can only nest a package
under another package.
@amolenaar amolenaar merged commit 435cfd0 into main Dec 26, 2022
@amolenaar
Copy link
Member

Yup. Sometimes a solution is as simple as this :).

@amolenaar amolenaar deleted the fix-add-package-menu branch December 26, 2022 20:53
@amolenaar amolenaar added this to the 2.15 milestone Dec 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix A fix for a bug python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unexpected error after creating a package
2 participants