Skip to content

Commit

Permalink
fix: bugprone-error
Browse files Browse the repository at this point in the history
Signed-off-by: kobayu858 <[email protected]>
  • Loading branch information
kobayu858 committed Dec 20, 2024
1 parent a88e90e commit 4d39ff1
Showing 1 changed file with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,7 @@ DecisionResult IntersectionModule::modifyPathVelocityDetail(PathWithLaneId * pat
(std::fabs(dist_stopline) < planner_param_.common.stopline_overshoot_margin);
const bool over_stopline = (dist_stopline < 0.0);
const bool is_stopped_duration = planner_data_->isVehicleStopped(duration);
if (over_stopline) {
state_machine.setState(StateMachine::State::GO);
} else if (is_stopped_duration && approached_dist_stopline) {
if (over_stopline || (is_stopped_duration && approached_dist_stopline)) {

Check warning on line 356 in planning/behavior_velocity_planner/autoware_behavior_velocity_intersection_module/src/scene_intersection.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Conditional

IntersectionModule::modifyPathVelocityDetail has 1 complex conditionals with 2 branches, threshold = 2. A complex conditional is an expression inside a branch (e.g. if, for, while) which consists of multiple, logical operators such as AND/OR. The more logical operators in an expression, the more severe the code smell.
state_machine.setState(StateMachine::State::GO);
}
return state_machine.getState() == StateMachine::State::GO;
Expand All @@ -366,12 +364,7 @@ DecisionResult IntersectionModule::modifyPathVelocityDetail(PathWithLaneId * pat
(std::fabs(dist_stopline) < planner_param_.common.stopline_overshoot_margin);
const bool over_stopline = (dist_stopline < -planner_param_.common.stopline_overshoot_margin);
const bool is_stopped = planner_data_->isVehicleStopped(duration);
if (over_stopline) {
return true;
} else if (is_stopped && approached_dist_stopline) {
return true;
}
return false;
return over_stopline || (is_stopped && approached_dist_stopline);

Check notice on line 367 in planning/behavior_velocity_planner/autoware_behavior_velocity_intersection_module/src/scene_intersection.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Complex Method

IntersectionModule::modifyPathVelocityDetail decreases in cyclomatic complexity from 50 to 49, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
};

const auto occlusion_wo_tl_pass_judge_line_idx =
Expand Down

0 comments on commit 4d39ff1

Please sign in to comment.