Skip to content

Commit

Permalink
refactor(goal_planner): remove duplicated execution condition
Browse files Browse the repository at this point in the history
Signed-off-by: kosuke55 <kosuke.tnp@gmail.com>
  • Loading branch information
kosuke55 committed Jan 16, 2024
1 parent 3928295 commit f1152b4
Showing 1 changed file with 0 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -399,13 +399,6 @@ bool GoalPlannerModule::isExecutionRequested() const
return false;
}

Check notice on line 401 in planning/behavior_path_goal_planner_module/src/goal_planner_module.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Complex Method

GoalPlannerModule::isExecutionRequested decreases in cyclomatic complexity from 14 to 13, 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.
// if goal modification is not allowed
// 1) goal_pose is in current_lanes, plan path to the original fixed goal
// 2) goal_pose is NOT in current_lanes, do not execute goal_planner
if (!goal_planner_utils::isAllowedGoalModification(route_handler)) {
return goal_is_in_current_lanes;
}

// if (A) or (B) is met execute pull over
// (A) target lane is `road` and same to the current lanes
// (B) target lane is `road_shoulder` and neighboring to the current lanes
Expand Down

0 comments on commit f1152b4

Please sign in to comment.