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(mrm_handler): simplify hazard command choice #9929

Merged
merged 1 commit into from
Jan 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions system/mrm_handler/src/mrm_handler/mrm_handler_core.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2024 TIER IV, Inc.

Check notice on line 1 in system/mrm_handler/src/mrm_handler/mrm_handler_core.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Overall Code Complexity

The mean cyclomatic complexity decreases from 5.57 to 5.52, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -115,12 +115,7 @@
HazardLightsCommand msg;

msg.stamp = this->now();
if (is_emergency_holding_) {
// turn hazard on during emergency holding
msg.command = HazardLightsCommand::ENABLE;
} 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 (param_.turning_hazard_on.emergency && isEmergency()) {
msg.command = HazardLightsCommand::ENABLE;
} else {
msg.command = HazardLightsCommand::NO_COMMAND;
Expand Down
Loading