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: move ramstk_load_history to sub-package #993

Merged
merged 26 commits into from
Feb 22, 2022

Conversation

weibullguy
Copy link
Collaborator

@weibullguy weibullguy commented Feb 22, 2022

Does this PR introduce a breaking change?

  • Yes
  • No

Describe the purpose of this pull request.

To move common database tables into sub-packages under commondb.

Describe how this was implemented.

Created load_history package. Moved ramstk_loadhistory.py to load_history package as record.py and added table.py. Updated test suite for load history package.

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

None

Provide any other pertinent information.

Partially implements #846

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 the type: refactor Issue or PR dealing with refactoring of RAMSTK code. label Feb 22, 2022
@weibullguy weibullguy changed the title Refactor/move ramstkloadhistory subpackage refactor: move ramstk_load_history to sub-package Feb 22, 2022
@weibullguy weibullguy self-assigned this Feb 22, 2022
@github-actions github-actions bot added the status: inprogress Issue or PR is open, milestoned, and assigned. label Feb 22, 2022
@weibullguy weibullguy removed the status: inprogress Issue or PR is open, milestoned, and assigned. label Feb 22, 2022
@weibullguy weibullguy added priority: normal Issue or PR is normal priority. status: inprogress Issue or PR is open, milestoned, and assigned. labels Feb 22, 2022
@codecov
Copy link

codecov bot commented Feb 22, 2022

Codecov Report

Merging #993 (eb3fce6) into master (7ea9513) will increase coverage by 0.00%.
The diff coverage is 99.24%.

❗ Current head eb3fce6 differs from pull request most recent head f66c7c8. Consider uploading reports for the commit f66c7c8 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #993   +/-   ##
=======================================
  Coverage   94.89%   94.90%           
=======================================
  Files         166      168    +2     
  Lines        5312     5236   -76     
  Branches      518      501   -17     
=======================================
- Hits         5041     4969   -72     
+ Misses        234      232    -2     
+ Partials       37       35    -2     
Flag Coverage Δ
3.6 94.89% <99.24%> (+<0.01%) ⬆️
3.7 94.89% <99.24%> (+<0.01%) ⬆️
3.8 94.90% <99.24%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
src/ramstk/analyses/statistics/bounds.py 64.70% <0.00%> (+3.59%) ⬆️
src/ramstk/models/__init__.py 100.00% <ø> (ø)
src/ramstk/models/commondb/__init__.py 100.00% <ø> (ø)
src/ramstk/models/programdb/hardware/view.py 100.00% <ø> (ø)
src/ramstk/models/programdb/validation/table.py 100.00% <ø> (ø)
src/ramstk/analyses/allocation.py 98.61% <100.00%> (-0.03%) ⬇️
src/ramstk/analyses/criticality.py 100.00% <100.00%> (ø)
src/ramstk/analyses/fha.py 100.00% <100.00%> (ø)
src/ramstk/analyses/milhdbk217f/milhdbk217f.py 94.11% <100.00%> (-0.25%) ⬇️
...rc/ramstk/analyses/milhdbk217f/models/capacitor.py 100.00% <100.00%> (ø)
... and 45 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 7ea9513...f66c7c8. Read the comment docs.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Feb 22, 2022

Sourcery Code Quality Report

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

Quality metrics Before After Change
Complexity 2.21 ⭐ 2.16 ⭐ -0.05 👍
Method Length 75.55 🙂 75.71 🙂 0.16 👎
Working memory 5.52 ⭐ 5.56 ⭐ 0.04 👎
Quality 77.59% 77.37% -0.22% 👎
Other metrics Before After Change
Lines 16055 15809 -246
Changed files Quality Before Quality After Quality Change
src/ramstk/analyses/allocation.py 77.45% ⭐ 77.08% ⭐ -0.37% 👎
src/ramstk/analyses/criticality.py 86.07% ⭐ 86.40% ⭐ 0.33% 👍
src/ramstk/analyses/fha.py 81.88% ⭐ 82.71% ⭐ 0.83% 👍
src/ramstk/analyses/milhdbk217f/milhdbk217f.py 59.37% 🙂 60.59% 🙂 1.22% 👍
src/ramstk/analyses/milhdbk217f/models/capacitor.py 74.49% 🙂 74.06% 🙂 -0.43% 👎
src/ramstk/analyses/milhdbk217f/models/connection.py 74.36% 🙂 72.14% 🙂 -2.22% 👎
src/ramstk/analyses/milhdbk217f/models/integratedcircuit.py 65.26% 🙂 64.03% 🙂 -1.23% 👎
src/ramstk/analyses/milhdbk217f/models/meter.py 80.95% ⭐ 80.80% ⭐ -0.15% 👎
src/ramstk/analyses/milhdbk217f/models/relay.py 77.41% ⭐ 76.94% ⭐ -0.47% 👎
src/ramstk/analyses/milhdbk217f/models/resistor.py 67.36% 🙂 67.44% 🙂 0.08% 👍
src/ramstk/analyses/milhdbk217f/models/switch.py 71.53% 🙂 70.63% 🙂 -0.90% 👎
src/ramstk/analyses/statistics/bounds.py 75.20% ⭐ 75.52% ⭐ 0.32% 👍
src/ramstk/analyses/statistics/exponential.py 77.76% ⭐ 77.11% ⭐ -0.65% 👎
src/ramstk/analyses/statistics/lognormal.py 74.00% 🙂 73.19% 🙂 -0.81% 👎
src/ramstk/analyses/statistics/normal.py 75.80% ⭐ 75.14% ⭐ -0.66% 👎
src/ramstk/analyses/statistics/weibull.py 74.07% 🙂 73.24% 🙂 -0.83% 👎
src/ramstk/db/base.py 70.60% 🙂 70.71% 🙂 0.11% 👍
src/ramstk/exim/imports.py 75.68% ⭐ 75.52% ⭐ -0.16% 👎
src/ramstk/models/init.py % % %
src/ramstk/models/commondb/init.py % % %
src/ramstk/models/commondb/database.py 80.32% ⭐ 80.32% ⭐ 0.00%
src/ramstk/models/commondb/ramstkmanufacturer.py 98.00% ⭐ 98.50% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstkmeasurement.py 98.00% ⭐ 98.50% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstkmethod.py 98.00% ⭐ 98.50% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstkmodel.py 98.50% ⭐ 99.00% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstkrpn.py 97.50% ⭐ 98.00% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstkstakeholders.py 99.00% ⭐ 99.50% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstkstatus.py 98.00% ⭐ 98.50% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstktype.py 98.00% ⭐ 98.50% ⭐ 0.50% 👍
src/ramstk/models/commondb/ramstkuser.py 97.01% ⭐ 97.50% ⭐ 0.49% 👍
src/ramstk/models/commondb/site_info/record.py 89.83% ⭐ 90.29% ⭐ 0.46% 👍
src/ramstk/models/programdb/action/record.py 94.06% ⭐ 94.55% ⭐ 0.49% 👍
src/ramstk/models/programdb/allocation/record.py 88.94% ⭐ 89.38% ⭐ 0.44% 👍
src/ramstk/models/programdb/cause/record.py 95.04% ⭐ 95.53% ⭐ 0.49% 👍
src/ramstk/models/programdb/control/record.py 98.00% ⭐ 98.50% ⭐ 0.50% 👍
src/ramstk/models/programdb/design_mechanic/record.py 77.96% ⭐ 78.24% ⭐ 0.28% 👍
src/ramstk/models/programdb/fmea/view.py 73.99% 🙂 73.40% 🙂 -0.59% 👎
src/ramstk/models/programdb/function/record.py 89.38% ⭐ 89.83% ⭐ 0.45% 👍
src/ramstk/models/programdb/hardware/record.py 84.37% ⭐ 84.57% ⭐ 0.20% 👍
src/ramstk/models/programdb/hardware/view.py 78.33% ⭐ 78.33% ⭐ 0.00%
src/ramstk/models/programdb/hazard/record.py 81.75% ⭐ 82.10% ⭐ 0.35% 👍
src/ramstk/models/programdb/mechanism/record.py 95.04% ⭐ 95.53% ⭐ 0.49% 👍
src/ramstk/models/programdb/milhdbk217f/record.py 83.57% ⭐ 83.95% ⭐ 0.38% 👍
src/ramstk/models/programdb/mode/record.py 86.77% ⭐ 87.19% ⭐ 0.42% 👍
src/ramstk/models/programdb/nswc/record.py 76.62% ⭐ 76.88% ⭐ 0.26% 👍
src/ramstk/models/programdb/program_info/record.py 89.38% ⭐ 89.83% ⭐ 0.45% 👍
src/ramstk/models/programdb/program_status/record.py 97.50% ⭐ 98.00% ⭐ 0.50% 👍
src/ramstk/models/programdb/requirement/record.py 87.63% ⭐ 88.88% ⭐ 1.25% 👍
src/ramstk/models/programdb/revision/record.py 87.19% ⭐ 87.62% ⭐ 0.43% 👍
src/ramstk/models/programdb/similar_item/record.py 77.68% ⭐ 77.96% ⭐ 0.28% 👍
src/ramstk/models/programdb/stakeholder/record.py 92.15% ⭐ 92.62% ⭐ 0.47% 👍
src/ramstk/models/programdb/validation/table.py 77.84% ⭐ 78.21% ⭐ 0.37% 👍
src/ramstk/views/gtk3/allocation/panel.py 75.56% ⭐ 75.60% ⭐ 0.04% 👍
src/ramstk/views/gtk3/assistants/imports.py 84.69% ⭐ 84.72% ⭐ 0.03% 👍
src/ramstk/views/gtk3/stakeholder/panel.py 79.14% ⭐ 79.25% ⭐ 0.11% 👍
src/ramstk/views/gtk3/widgets/button.py 85.04% ⭐ 85.06% ⭐ 0.02% 👍
src/ramstk/views/gtk3/widgets/combo.py 83.67% ⭐ 84.03% ⭐ 0.36% 👍
src/ramstk/views/gtk3/widgets/label.py 83.02% ⭐ 84.16% ⭐ 1.14% 👍
src/ramstk/views/gtk3/widgets/plot.py 83.11% ⭐ 83.21% ⭐ 0.10% 👍
tests/conftest.py 79.93% ⭐ 79.89% ⭐ -0.04% 👎
tests/test_configuration.py 74.32% 🙂 74.96% 🙂 0.64% 👍
tests/analyses/milhdbk217f/models/test_connection.py 82.79% ⭐ 83.02% ⭐ 0.23% 👍
tests/analyses/statistics/distributions/_test_mcf.py 85.84% ⭐ 85.93% ⭐ 0.09% 👍
tests/mocks/MockDAO.py 96.07% ⭐ 97.28% ⭐ 1.21% 👍

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

File Function Complexity Length Working Memory Quality Recommendation
src/ramstk/analyses/milhdbk217f/models/integratedcircuit.py calculate_part_stress 7 ⭐ 433 ⛔ 16 ⛔ 34.79% 😞 Try splitting into smaller methods. Extract out complex expressions
tests/test_configuration.py TestCreateConfiguration.test_initialize_user_configuration 6 ⭐ 389 ⛔ 11 😞 43.37% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/analyses/milhdbk217f/milhdbk217f.py do_predict_active_hazard_rate 4 ⭐ 155 😞 26 ⛔ 43.66% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/db/base.py BaseDatabase.do_connect 5 ⭐ 210 ⛔ 15 😞 44.84% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/analyses/fha.py calculate_user_defined 0 ⭐ 308 ⛔ 14 😞 46.34% 😞 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!

@sonarcloud
Copy link

sonarcloud bot commented Feb 22, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

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

No Coverage information No Coverage information
0.0% 0.0% Duplication

@weibullguy weibullguy merged commit aebf046 into master Feb 22, 2022
@weibullguy weibullguy deleted the refactor/move_ramstkloadhistory_subpackage branch February 22, 2022 01:24
@trafico-bot trafico-bot bot added the endgame: merged Pull Request has been merged successfully label Feb 22, 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 3, 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.

None yet

1 participant