-
Notifications
You must be signed in to change notification settings - Fork 15
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: allocation calculations #1411
Conversation
Reviewer's Guide by SourceryThis pull request refactors the allocation calculations in the RAMSTK project. The main changes include improved error handling, code organization, and the introduction of helper functions to reduce code duplication. The refactoring aims to make the code more maintainable and easier to understand. Class diagram for refactored allocation calculationsclassDiagram
direction TB
class Allocation {
+Dict _calculate_agree_apportionment(float parent_goal, Dict attributes)
+Dict _calculate_arinc_apportionment(float parent_goal, Dict attributes)
+Dict _calculate_equal_apportionment(float parent_goal, Dict attributes)
+Dict _calculate_foo_apportionment(float parent_goal, int cum_weight, Dict attributes)
+Dict do_allocate_reliability(float parent_goal, int cumulative_weight, **attributes)
+Dict _calculate_common_values(Dict attributes)
+void _send_pubsub_message(string message_type, string message)
}
Allocation --> PubSub : uses
class PubSub {
+void sendMessage(string message_type, string error_message)
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @weibullguy - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Does this PR introduce a breaking change?
Describe the purpose of this pull request.
This PR refactors the Allocation calculations.
Describe how this was implemented.
Ran code through ChatGPT.
Describe any particular area(s) reviewers should focus on.
None
Provide any other pertinent information.
Pull Request Checklist
Code Style
Static Checks
this PR.
Tests
Chores
this PR. These problem areas have been decorated with an ISSUE: # comment.
Summary by Sourcery
Refactor allocation calculations to enhance code clarity and error handling, and update tests to align with these changes.
Enhancements:
_send_pubsub_message
to streamline the sending of failure messages via pubsub.do_allocate_reliability
function to use a dictionary for method selection, simplifying the allocation method dispatch logic.Tests: