Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Takagi <[email protected]>
  • Loading branch information
yuki-takagi-66 committed Jan 31, 2024
1 parent 386e1a6 commit b08e745
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion planning/obstacle_stop_planner/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1548,9 +1548,10 @@ void ObstacleStopPlannerNode::filterObstacles(
const PredictedObjects & input_objects, const Pose & ego_pose, const TrajectoryPoints & traj,
const double dist_threshold, PredictedObjects & filtered_objects)
{
filtered_objects.header = input_objects.header;
if (traj.size() < 2) return;

Check warning on line 1552 in planning/obstacle_stop_planner/src/node.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

ObstacleStopPlannerNode::filterObstacles increases in cyclomatic complexity from 9 to 10, 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.
filtered_objects.header = input_objects.header;

for (auto & object : input_objects.objects) {
// Check is it in front of ego vehicle
if (!isFrontObstacle(ego_pose, object.kinematics.initial_pose_with_covariance.pose.position)) {
Expand Down

0 comments on commit b08e745

Please sign in to comment.