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

fix: prevent adding sibling to top level hardware item #986

Merged
merged 7 commits into from
Feb 20, 2022

Conversation

weibullguy
Copy link
Collaborator

@weibullguy weibullguy commented Feb 20, 2022

Does this PR introduce a breaking change?

  • Yes
  • No

Describe the purpose of this pull request.

To prevent user from adding a sibling to the top level hardware item (system).

Describe how this was implemented.

Added check for parent ID. Parent ID = 0 indicates top level hardware item. Now raises information dialog and returns. Also added similar check to methods to insert sibling and part to check that user is not trying to add a sibling or part to a part.

Describe any particular area(s) reviewers should focus on.

None

Provide any other pertinent information.

Closes #959

Pull Request Checklist

  • Code Style

    • Code is following code style guidelines.
  • Static Checks

    • Failing static checks are only applicable to code outside the scope of
      this PR.
  • Tests

    • At least one test for all newly created functions/methods?
  • Chores

    • Problem areas outside the scope of this PR have an # ISSUE: comment
      decorating the code block. These # ISSUE: comments are automatically
      converted to issues on successful merge. Alternatively, you can manually
      raise an issue for each problem area you identify.

@github-actions github-actions bot added bump: patch Issue or PR documents a bug fix or enhancement requiring a patch version bump. type: fix Issue or PR affects existing functionality. labels Feb 20, 2022
@weibullguy weibullguy self-assigned this Feb 20, 2022
@github-actions github-actions bot added the status: inprogress Issue or PR is open, milestoned, and assigned. label Feb 20, 2022
@weibullguy weibullguy added the priority: normal Issue or PR is normal priority. label Feb 20, 2022
Co-authored-by: Sourcery AI <>
@codecov
Copy link

codecov bot commented Feb 20, 2022

Codecov Report

Merging #986 (d04eda5) into master (fce6cae) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #986   +/-   ##
=======================================
  Coverage   94.86%   94.86%           
=======================================
  Files         158      158           
  Lines        5274     5274           
  Branches      515      515           
=======================================
  Hits         5003     5003           
  Misses        234      234           
  Partials       37       37           
Flag Coverage Δ
3.6 94.86% <ø> (ø)
3.7 94.86% <ø> (ø)
3.8 94.86% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out 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 fce6cae...d04eda5. Read the comment docs.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 20, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.72 ⭐ 0.84 ⭐ 0.12 👎
Method Length 82.74 🙂 85.21 🙂 2.47 👎
Working memory 5.82 ⭐ 6.10 ⭐ 0.28 👎
Quality 78.00% 76.74% -1.26% 👎
Other metrics Before After Change
Lines 2645 2688 43
Changed files Quality Before Quality After Quality Change
src/ramstk/views/gtk3/hardware/panel.py 69.22% 🙂 69.12% 🙂 -0.10% 👎
src/ramstk/views/gtk3/hardware/view.py 82.98% ⭐ 79.32% ⭐ -3.66% 👎
src/ramstk/views/gtk3/widgets/dialog.py 79.41% ⭐ 79.41% ⭐ 0.00%

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

File Function Complexity Length Working Memory Quality Recommendation
src/ramstk/views/gtk3/hardware/panel.py HardwareTreePanel._on_module_switch._on_workview_edit.HardwareGeneralDataPanel.__init__ 0 ⭐ 441 ⛔ 18 ⛔ 39.76% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/views/gtk3/hardware/panel.py HardwareTreePanel._on_module_switch._on_workview_edit.HardwareGeneralDataPanel._request_load_component.HardwareLogisticsPanel.__init__ 0 ⭐ 239 ⛔ 14 😞 49.25% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/views/gtk3/widgets/dialog.py RAMSTKDatabaseSelect.__init__ 0 ⭐ 159 😞 11 😞 60.10% 🙂 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/views/gtk3/hardware/panel.py HardwareTreePanel.__init__ 0 ⭐ 1020 ⛔ 5 ⭐ 61.38% 🙂 Try splitting into smaller methods
src/ramstk/views/gtk3/hardware/view.py HardwareModuleView._do_request_insert_sibling 2 ⭐ 124 😞 9 🙂 65.95% 🙂 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!

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
71.1% 71.1% Duplication

@weibullguy weibullguy merged commit 8e0b66f into master Feb 20, 2022
@trafico-bot trafico-bot bot added the endgame: merged Pull Request has been merged successfully label Feb 20, 2022
@weibullguy weibullguy deleted the fix/issue-959 branch February 20, 2022 17:19
@github-actions github-actions bot added status: closed Pull Request is complete and integrated or closed for anther reason. and removed status: inprogress Issue or PR is open, milestoned, and assigned. labels Feb 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump: patch Issue or PR documents a bug fix or enhancement requiring a patch version bump. endgame: merged Pull Request has been merged successfully priority: normal Issue or PR is normal priority. status: closed Pull Request is complete and integrated or closed for anther reason. type: fix Issue or PR affects existing functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hardware module allows adding a sibling to the top-level item
1 participant