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: hazard rate calculations not recursively calculated #982

Merged
merged 4 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 make hardware calculations recursive.

Describe how this was implemented.

Split do_calculate_hardware() method into one method per attribute to calculate. Added for loop with incrementing value in each new method to account for the need to sum children quantities for the parent.

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

None

Provide any other pertinent information.

Close #960

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
@weibullguy weibullguy added priority: normal Issue or PR is normal priority. status: inprogress Issue or PR is open, milestoned, and assigned. labels Feb 20, 2022
Co-authored-by: Sourcery AI <>
@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.27%.

Quality metrics Before After Change
Complexity 0.34 ⭐ 0.37 ⭐ 0.03 👎
Method Length 50.83 ⭐ 52.79 ⭐ 1.96 👎
Working memory 5.02 ⭐ 5.34 ⭐ 0.32 👎
Quality 81.27% 80.00% -1.27% 👎
Other metrics Before After Change
Lines 3976 4088 112
Changed files Quality Before Quality After Quality Change
src/ramstk/analyses/milhdbk217f/models/inductor.py 75.13% ⭐ 74.17% 🙂 -0.96% 👎
src/ramstk/models/programdb/hardware/view.py 76.12% ⭐ 78.33% ⭐ 2.21% 👍
src/ramstk/models/programdb/reliability/record.py 75.57% ⭐ 75.64% ⭐ 0.07% 👍
tests/models/programdb/design_electric/design_electric_integration_test.py 85.40% ⭐ 85.36% ⭐ -0.04% 👎
tests/models/programdb/design_mechanic/design_mechanic_integration_test.py 84.09% ⭐ 83.96% ⭐ -0.13% 👎
tests/models/programdb/hardware/hardware_integration_test.py 74.12% 🙂 70.66% 🙂 -3.46% 👎
tests/models/programdb/milhdbk217f/milhdbk217f_integration_test.py 86.67% ⭐ 86.52% ⭐ -0.15% 👎
tests/models/programdb/nswc/nswc_integration_test.py 83.94% ⭐ 83.81% ⭐ -0.13% 👎
tests/models/programdb/reliability/reliability_integration_test.py 85.98% ⭐ 85.84% ⭐ -0.14% 👎

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

File Function Complexity Length Working Memory Quality Recommendation
tests/models/programdb/hardware/hardware_integration_test.py TestGetterSetter.test_do_set_attributes.TestAnalysisMethods.test_do_predict_hazard_rate_active_assembly_assessed 1 ⭐ 348 ⛔ 12 😞 47.30% 😞 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/models/programdb/reliability/record.py RAMSTKReliabilityRecord.do_calculate_hazard_rate_active 4 ⭐ 158 😞 15 😞 50.24% 🙂 Try splitting into smaller methods. Extract out complex expressions
tests/models/programdb/hardware/hardware_integration_test.py TestGetterSetter.test_do_set_attributes.TestAnalysisMethods.test_do_calculate_hardware 0 ⭐ 268 ⛔ 12 😞 50.80% 🙂 Try splitting into smaller methods. Extract out complex expressions
src/ramstk/analyses/milhdbk217f/models/inductor.py calculate_part_stress 10 🙂 195 😞 9 🙂 51.14% 🙂 Try splitting into smaller methods
tests/models/programdb/hardware/hardware_integration_test.py TestSelectMethods.test_on_select_all_tree_loaded 0 ⭐ 236 ⛔ 11 😞 54.14% 🙂 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 20, 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 1 Code Smell

No Coverage information No Coverage information
10.2% 10.2% Duplication

@codecov
Copy link

codecov bot commented Feb 20, 2022

Codecov Report

Merging #982 (ec710b2) into master (630a0b1) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #982      +/-   ##
==========================================
+ Coverage   94.84%   94.86%   +0.01%     
==========================================
  Files         158      158              
  Lines        5254     5274      +20     
  Branches      515      515              
==========================================
+ Hits         4983     5003      +20     
  Misses        234      234              
  Partials       37       37              
Flag Coverage Δ
3.6 94.86% <100.00%> (+0.01%) ⬆️
3.7 94.86% <100.00%> (+0.01%) ⬆️
3.8 94.86% <100.00%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
src/ramstk/analyses/milhdbk217f/models/inductor.py 95.74% <100.00%> (-0.34%) ⬇️
src/ramstk/models/programdb/hardware/view.py 100.00% <100.00%> (ø)
src/ramstk/models/programdb/reliability/record.py 100.00% <100.00%> (ø)

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 44130fb...ec710b2. Read the comment docs.

@weibullguy weibullguy merged commit 25f6263 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-960 branch February 20, 2022 06:46
@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.

Hazard rate calculations not "rolling up"
1 participant