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: remove if-else control block in do_select_all() method #1019

Merged
merged 4 commits into from
Mar 3, 2022

Conversation

weibullguy
Copy link
Collaborator

@weibullguy weibullguy commented Mar 3, 2022

Does this PR introduce a breaking change?

  • Yes
  • No

Describe the purpose of this pull request.

To remove the deprecated approach in the do_select_all() method and to update pubsub messages and subscribers to use singular version of the _tag attribute.

Describe how this was implemented.

Removed if-else control block; only kept the else portion. Removed the _deprecated class attribute from all table models. Updated test suite.

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

None

Provide any other pertinent information.

Closes #1000

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

    • Issue(s) have been raised for problem areas outside the scope of
      this PR. These problem areas have been decorated with an ISSUE: # comment.

@github-actions github-actions bot added the type: refactor Issue or PR dealing with refactoring of RAMSTK code. label Mar 3, 2022
@weibullguy weibullguy self-assigned this Mar 3, 2022
@github-actions github-actions bot added the status: inprogress Issue or PR is open, milestoned, and assigned. label Mar 3, 2022
@weibullguy weibullguy added the priority: normal Issue or PR is normal priority. label Mar 3, 2022
@sonarcloud
Copy link

sonarcloud bot commented Mar 3, 2022

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
11.1% 11.1% Duplication

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 3, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 0.20 ⭐ 0.19 ⭐ -0.01 👍
Method Length 50.17 ⭐ 50.13 ⭐ -0.04 👍
Working memory 4.76 ⭐ 4.76 ⭐ 0.00
Quality 83.94% 83.97% 0.03% 👍
Other metrics Before After Change
Lines 36320 36283 -37
Changed files Quality Before Quality After Quality Change
src/ramstk/models/db/program_database.py 88.43% ⭐ 88.43% ⭐ 0.00%
src/ramstk/models/dbtables/basetable.py 73.14% 🙂 75.65% ⭐ 2.51% 👍
src/ramstk/models/dbtables/commondb_category_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_condition_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_failure_mode_table.py 94.35% ⭐ 94.35% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_group_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_hazards_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_load_history_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_manufacturer_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_measurement_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_method_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_model_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_rpn_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_stakeholders_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_status_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_subcategory_table.py 94.51% ⭐ 94.51% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_type_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/commondb_user_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_action_table.py 93.57% ⭐ 93.57% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_allocation_table.py 81.88% ⭐ 81.88% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_cause_table.py 88.20% ⭐ 88.20% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_control_table.py 91.15% ⭐ 91.15% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_design_mechanic_table.py 95.76% ⭐ 95.76% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_environment_table.py 94.73% ⭐ 94.73% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_failure_definition_table.py 95.29% ⭐ 95.29% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_function_table.py 93.32% ⭐ 93.32% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_hardware_table.py 92.67% ⭐ 92.67% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_hazard_table.py 81.42% ⭐ 81.42% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_mechanism_table.py 89.43% ⭐ 89.43% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_milhdbk217f_table.py 95.76% ⭐ 95.76% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_mission_phase_table.py 95.29% ⭐ 95.29% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_mission_table.py 95.76% ⭐ 95.76% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_mode_table.py 92.47% ⭐ 92.47% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_nswc_table.py 95.76% ⭐ 95.76% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_opload_table.py 94.24% ⭐ 94.24% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_opstress_table.py 93.57% ⭐ 93.57% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_program_info_table.py 94.68% ⭐ 94.68% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_program_status_table.py 86.95% ⭐ 86.95% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_reliability_table.py 95.76% ⭐ 95.76% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_requirement_table.py 87.24% ⭐ 87.24% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_revision_table.py 96.17% ⭐ 96.17% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_similar_item_table.py 74.70% 🙂 74.70% 🙂 0.00%
src/ramstk/models/dbtables/programdb_stakeholder_table.py 89.10% ⭐ 89.10% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_test_method_table.py 93.57% ⭐ 93.57% ⭐ 0.00%
src/ramstk/models/dbtables/programdb_validation_table.py 78.21% ⭐ 78.21% ⭐ 0.00%
src/ramstk/models/dbviews/programdb_fmea_view.py 73.99% 🙂 73.99% 🙂 0.00%
src/ramstk/models/dbviews/programdb_hardware_view.py 78.33% ⭐ 78.33% ⭐ 0.00%
src/ramstk/models/dbviews/programdb_pof_view.py 75.64% ⭐ 75.64% ⭐ 0.00%
src/ramstk/models/dbviews/programdb_usage_profile_view.py 79.03% ⭐ 79.03% ⭐ 0.00%
src/ramstk/views/gtk3/allocation/panel.py 75.60% ⭐ 75.60% ⭐ 0.00%
src/ramstk/views/gtk3/assistants/export.py 72.26% 🙂 72.26% 🙂 0.00%
src/ramstk/views/gtk3/books/modulebook.py 89.74% ⭐ 89.74% ⭐ 0.00%
src/ramstk/views/gtk3/fmea/panel.py 78.44% ⭐ 78.44% ⭐ 0.00%
src/ramstk/views/gtk3/function/panel.py 71.66% 🙂 71.66% 🙂 0.00%
src/ramstk/views/gtk3/hardware/panel.py 69.12% 🙂 69.12% 🙂 0.00%
src/ramstk/views/gtk3/hazard_analysis/panel.py 81.81% ⭐ 81.81% ⭐ 0.00%
src/ramstk/views/gtk3/requirement/panel.py 63.64% 🙂 63.64% 🙂 0.00%
src/ramstk/views/gtk3/revision/panel.py 74.79% 🙂 74.79% 🙂 0.00%
src/ramstk/views/gtk3/similar_item/panel.py 81.83% ⭐ 81.83% ⭐ 0.00%
src/ramstk/views/gtk3/stakeholder/panel.py 79.25% ⭐ 79.25% ⭐ 0.00%
src/ramstk/views/gtk3/widgets/baseview.py 83.60% ⭐ 83.62% ⭐ 0.02% 👍
tests/models/commondb/category/category_integration_test.py 88.21% ⭐ 88.21% ⭐ 0.00%
tests/models/commondb/condition/condition_integration_test.py 89.17% ⭐ 89.17% ⭐ 0.00%
tests/models/commondb/failure_mode/failure_mode_integration_test.py 89.04% ⭐ 89.04% ⭐ 0.00%
tests/models/commondb/group/group_integration_test.py 89.17% ⭐ 89.17% ⭐ 0.00%
tests/models/commondb/hazards/hazards_integration_test.py 89.29% ⭐ 89.29% ⭐ 0.00%
tests/models/commondb/load_history/load_history_integration_test.py 91.04% ⭐ 91.04% ⭐ 0.00%
tests/models/commondb/manufacturer/manufacturer_integration_test.py 88.32% ⭐ 88.32% ⭐ 0.00%
tests/models/commondb/measurement/measurement_integration_test.py 89.17% ⭐ 89.17% ⭐ 0.00%
tests/models/commondb/method/method_integration_test.py 90.81% ⭐ 90.81% ⭐ 0.00%
tests/models/commondb/model/model_integration_test.py 90.83% ⭐ 90.83% ⭐ 0.00%
tests/models/commondb/rpn/rpn_integration_test.py 90.88% ⭐ 90.88% ⭐ 0.00%
tests/models/commondb/site_info/site_info_integration_test.py 88.17% ⭐ 88.17% ⭐ 0.00%
tests/models/commondb/stakeholders/stakeholders_integration_test.py 91.85% ⭐ 91.85% ⭐ 0.00%
tests/models/commondb/status/status_integration_test.py 91.04% ⭐ 91.04% ⭐ 0.00%
tests/models/commondb/subcategory/subcategory_integration_test.py 91.04% ⭐ 91.04% ⭐ 0.00%
tests/models/commondb/type/type_integration_test.py 90.81% ⭐ 90.81% ⭐ 0.00%
tests/models/commondb/user/user_integration_test.py 90.73% ⭐ 90.73% ⭐ 0.00%
tests/models/programdb/test_program_manager.py 85.89% ⭐ 85.89% ⭐ 0.00%
tests/models/programdb/action/action_integration_test.py 89.46% ⭐ 89.46% ⭐ 0.00%
tests/models/programdb/allocation/allocation_integration_test.py 86.31% ⭐ 86.31% ⭐ 0.00%
tests/models/programdb/allocation/allocation_unit_test.py 80.78% ⭐ 80.78% ⭐ 0.00%
tests/models/programdb/cause/cause_integration_test.py 88.92% ⭐ 88.92% ⭐ 0.00%
tests/models/programdb/control/control_integration_test.py 89.96% ⭐ 90.06% ⭐ 0.10% 👍
tests/models/programdb/design_electric/design_electric_integration_test.py 85.41% ⭐ 85.42% ⭐ 0.01% 👍
tests/models/programdb/design_electric/design_electric_unit_test.py 77.04% ⭐ 77.04% ⭐ 0.00%
tests/models/programdb/design_mechanic/design_mechanic_integration_test.py 84.03% ⭐ 84.03% ⭐ 0.00%
tests/models/programdb/design_mechanic/design_mechanic_unit_test.py 75.13% ⭐ 75.13% ⭐ 0.00%
tests/models/programdb/environment/environment_integration_test.py 92.97% ⭐ 92.97% ⭐ 0.00%
tests/models/programdb/environment/environment_unit_test.py 87.55% ⭐ 87.55% ⭐ 0.00%
tests/models/programdb/failure_definition/failure_definition_integration_test.py 91.64% ⭐ 91.64% ⭐ 0.00%
tests/models/programdb/failure_definition/failure_definition_unit_test.py 87.91% ⭐ 87.91% ⭐ 0.00%
tests/models/programdb/fmea/fmea_integration_test.py 82.69% ⭐ 82.69% ⭐ 0.00%
tests/models/programdb/fmea/fmea_unit_test.py 79.97% ⭐ 79.97% ⭐ 0.00%
tests/models/programdb/function/function_integration_test.py 90.12% ⭐ 90.12% ⭐ 0.00%
tests/models/programdb/function/function_unit_test.py 83.88% ⭐ 83.88% ⭐ 0.00%
tests/models/programdb/hardware/hardware_integration_test.py 71.08% 🙂 71.08% 🙂 0.00%
tests/models/programdb/hardware/hardware_unit_test.py 77.90% ⭐ 77.90% ⭐ 0.00%
tests/models/programdb/hazard/hazard_integration_test.py 90.30% ⭐ 90.30% ⭐ 0.00%
tests/models/programdb/hazard/hazard_unit_test.py 79.10% ⭐ 79.10% ⭐ 0.00%
tests/models/programdb/mechanism/mechanism_integration_test.py 89.88% ⭐ 89.88% ⭐ 0.00%
tests/models/programdb/milhdbk217f/milhdbk217f_integration_test.py 86.60% ⭐ 86.60% ⭐ 0.00%
tests/models/programdb/milhdbk217f/milhdbk217f_unit_test.py 78.71% ⭐ 78.71% ⭐ 0.00%
tests/models/programdb/mission/mission_integration_test.py 92.44% ⭐ 92.44% ⭐ 0.00%
tests/models/programdb/mission/mission_unit_test.py 88.42% ⭐ 88.42% ⭐ 0.00%
tests/models/programdb/mission_phase/mission_phase_integration_test.py 93.02% ⭐ 93.02% ⭐ 0.00%
tests/models/programdb/mission_phase/mission_phase_unit_test.py 88.21% ⭐ 88.21% ⭐ 0.00%
tests/models/programdb/mode/mode_integration_test.py 90.54% ⭐ 90.54% ⭐ 0.00%
tests/models/programdb/mode/mode_unit_test.py 82.04% ⭐ 82.04% ⭐ 0.00%
tests/models/programdb/nswc/nswc_integration_test.py 83.88% ⭐ 83.88% ⭐ 0.00%
tests/models/programdb/nswc/nswc_unit_test.py 74.31% 🙂 74.31% 🙂 0.00%
tests/models/programdb/opload/opload_integration_test.py 91.76% ⭐ 91.84% ⭐ 0.08% 👍
tests/models/programdb/opstress/opstress_integration_test.py 92.28% ⭐ 92.39% ⭐ 0.11% 👍
tests/models/programdb/pof/pof_integration_test.py 83.40% ⭐ 83.40% ⭐ 0.00%
tests/models/programdb/pof/pof_unit_test.py 82.48% ⭐ 82.48% ⭐ 0.00%
tests/models/programdb/program_info/program_info_integration_test.py 86.37% ⭐ 86.37% ⭐ 0.00%
tests/models/programdb/program_status/program_status_integration_test.py 90.70% ⭐ 90.70% ⭐ 0.00%
tests/models/programdb/program_status/program_status_unit_test.py 87.22% ⭐ 87.22% ⭐ 0.00%
tests/models/programdb/reliability/reliability_integration_test.py 85.92% ⭐ 85.92% ⭐ 0.00%
tests/models/programdb/reliability/reliability_unit_test.py 79.60% ⭐ 79.60% ⭐ 0.00%
tests/models/programdb/requirement/requirement_integration_test.py 91.24% ⭐ 91.24% ⭐ 0.00%
tests/models/programdb/requirement/requirement_unit_test.py 76.13% ⭐ 76.13% ⭐ 0.00%
tests/models/programdb/revision/revision_integration_test.py 92.09% ⭐ 92.09% ⭐ 0.00%
tests/models/programdb/revision/revision_unit_test.py 82.05% ⭐ 82.05% ⭐ 0.00%
tests/models/programdb/similar_item/similar_item_integration_test.py 82.14% ⭐ 82.14% ⭐ 0.00%
tests/models/programdb/similar_item/similar_item_unit_test.py 76.39% ⭐ 76.39% ⭐ 0.00%
tests/models/programdb/stakeholder/stakeholder_integration_test.py 90.43% ⭐ 90.43% ⭐ 0.00%
tests/models/programdb/stakeholder/stakeholder_unit_test.py 85.11% ⭐ 85.11% ⭐ 0.00%
tests/models/programdb/test_method/test_method_integration_test.py 92.50% ⭐ 92.62% ⭐ 0.12% 👍
tests/models/programdb/usage_profile/usage_profile_integration_test.py 81.95% ⭐ 81.95% ⭐ 0.00%
tests/models/programdb/usage_profile/usage_profile_unit_test.py 81.45% ⭐ 81.45% ⭐ 0.00%
tests/models/programdb/validation/validation_integration_test.py 83.05% ⭐ 83.05% ⭐ 0.00%
tests/models/programdb/validation/validation_unit_test.py 77.62% ⭐ 77.62% ⭐ 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 HardwareGeneralDataPanel.__init__ 0 ⭐ 441 ⛔ 18 ⛔ 39.76% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/views/gtk3/requirement/panel.py RequirementGeneralDataPanel.__init__ 0 ⭐ 361 ⛔ 13 😞 46.47% 😞 Try splitting into smaller methods. Extract out complex expressions
tests/models/programdb/hardware/hardware_integration_test.py TestAnalysisMethods.test_do_predict_hazard_rate_active_assembly_assessed 1 ⭐ 338 ⛔ 12 😞 47.52% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/views/gtk3/hardware/panel.py HardwareLogisticsPanel.__init__ 0 ⭐ 239 ⛔ 14 😞 49.25% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/views/gtk3/requirement/panel.py RequirementCompletenessPanel.__init__ 0 ⭐ 263 ⛔ 13 😞 49.45% 😞 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!

@codecov
Copy link

codecov bot commented Mar 3, 2022

Codecov Report

Merging #1019 (b390fdf) into master (fe136a2) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1019      +/-   ##
==========================================
- Coverage   94.81%   94.80%   -0.02%     
==========================================
  Files         144      144              
  Lines        5249     5194      -55     
  Branches      509      508       -1     
==========================================
- Hits         4977     4924      -53     
+ Misses        235      233       -2     
  Partials       37       37              
Flag Coverage Δ
3.6 94.80% <100.00%> (-0.02%) ⬇️
3.7 94.80% <100.00%> (-0.02%) ⬇️
3.8 94.80% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
.../ramstk/models/dbtables/commondb_category_table.py 100.00% <ø> (ø)
...ramstk/models/dbtables/commondb_condition_table.py 100.00% <ø> (ø)
...stk/models/dbtables/commondb_failure_mode_table.py 100.00% <ø> (ø)
src/ramstk/models/dbtables/commondb_group_table.py 100.00% <ø> (ø)
...c/ramstk/models/dbtables/commondb_hazards_table.py 100.00% <ø> (ø)
...stk/models/dbtables/commondb_load_history_table.py 100.00% <ø> (ø)
...stk/models/dbtables/commondb_manufacturer_table.py 100.00% <ø> (ø)
...mstk/models/dbtables/commondb_measurement_table.py 100.00% <ø> (ø)
...rc/ramstk/models/dbtables/commondb_method_table.py 100.00% <ø> (ø)
src/ramstk/models/dbtables/commondb_model_table.py 100.00% <ø> (ø)
... and 39 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 6b14567...b390fdf. Read the comment docs.

@weibullguy weibullguy merged commit ac19638 into master Mar 3, 2022
@weibullguy weibullguy deleted the refactor/issue-1000 branch March 3, 2022 16:34
@trafico-bot trafico-bot bot added the endgame: merged Pull Request has been merged successfully label Mar 3, 2022
@weibullguy weibullguy 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 Mar 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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: refactor Issue or PR dealing with refactoring of RAMSTK code.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove if-else Control from RAMSTKBaseTable do_select_all() Method
1 participant