-
Notifications
You must be signed in to change notification settings - Fork 662
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(mrm_handler): fix bugprone-branch-clone #9729
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: kobayu858 <[email protected]>
Thank you for contributing to the Autoware project! 🚧 If your pull request is in progress, switch it to draft mode. Please ensure:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9729 +/- ##
==========================================
- Coverage 29.74% 29.74% -0.01%
==========================================
Files 1443 1443
Lines 108681 108684 +3
Branches 42663 42662 -1
==========================================
- Hits 32330 32328 -2
- Misses 73172 73177 +5
Partials 3179 3179
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@@ -185,12 +184,12 @@ void MrmHandler::operateMrm() | |||
if (current_mrm_behavior == mrm_state_.behavior) { | |||
return; | |||
} | |||
if (!requestMrmBehavior(mrm_state_.behavior, RequestType::CANCEL)) { | |||
if ( |
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.
The following is more straghtforward:
if (requestMrmBehavior(current_mrm_behavior, RequestType::CALL)) {
mrm_state_.behavior = current_mrm_behavior;
} else {
handleFailedRequest();
}
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.
It has been fixed. Thank you.
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.
Sorry but my suggestion will change the behavior, since requestMrmBehavior
has side effects.
Please revert it.
} else if (isEmergency() && param_.turning_hazard_on.emergency) { | ||
// turn hazard on if vehicle is in emergency state and | ||
// turning hazard on if emergency flag is true | ||
if ( |
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.
@mkuri @TetsuKawa
The original implementation looks wierd: Is the following correct?
if (param_.turning_hazard_on.emergency) {
if (is_emergency_holding_ || isEmergency()) {
msg.command = HazardLightsCommand::ENABLE;
} else {
msg.command = HazardLightsCommand::NO_COMMAND;
}
} else {
msg.command = HazardLightsCommand::NO_COMMAND;
}
Signed-off-by: kobayu858 <[email protected]>
Description
This is a fix based on clang-tidy
bugprone-branch-clone
error.Related links
Parent Issue:
How was this PR tested?
Notes for reviewers
None.
Interface changes
None.
Effects on system behavior
None.