Skip to content

Commit

Permalink
style(pre-commit): autofix
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed May 31, 2024
1 parent 4a2f0ba commit 8e4a8c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ void visualizeBound(
}
const float adjusted_width = width / std::sin(diff_angle);
if (std::abs(adjusted_width) > 1.0) {
return std::make_pair(normal_vector_angle, adjusted_width / std::abs(adjusted_width));
return std::make_pair(normal_vector_angle, adjusted_width / std::abs(adjusted_width));
} else {
return std::make_pair(normal_vector_angle, adjusted_width);
return std::make_pair(normal_vector_angle, adjusted_width);
}
}();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1582,15 +1582,19 @@ std::vector<geometry_msgs::msg::Point> postProcess(
calcLongitudinalOffsetGoalPoint(tmp_bound, goal_pose, goal_start_idx, vehicle_length);
const auto p_tmp =
geometry_msgs::build<Pose>().position(goal_point).orientation(goal_pose.orientation);
const size_t goal_nearest_idx = findNearestSegmentIndexFromLateralDistance(tmp_bound, p_tmp, M_PI_2);
const size_t goal_idx = ((goal_start_idx - start_idx)*(goal_start_idx - start_idx) > (goal_nearest_idx - start_idx)*(goal_nearest_idx - start_idx)) ? goal_start_idx : goal_nearest_idx;
const size_t goal_nearest_idx =
findNearestSegmentIndexFromLateralDistance(tmp_bound, p_tmp, M_PI_2);
const size_t goal_idx = ((goal_start_idx - start_idx) * (goal_start_idx - start_idx) >
(goal_nearest_idx - start_idx) * (goal_nearest_idx - start_idx))
? goal_start_idx
: goal_nearest_idx;
return std::make_pair(goal_idx, goal_point);
}();

// Insert middle points
size_t step = (start_idx < goal_idx) ? 1 : -1;
for (size_t i = start_idx + step; i != goal_idx + step; i += step) {

Check warning on line 1596 in planning/behavior_path_planner_common/src/utils/drivable_area_expansion/static_drivable_area.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

❌ Getting worse: Complex Method

postProcess increases in cyclomatic complexity from 26 to 27, 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 &next_point = tmp_bound.at(i);
const auto & next_point = tmp_bound.at(i);
const double dist = tier4_autoware_utils::calcDistance2d(processed_bound.back(), next_point);
if (dist > overlap_threshold) {
processed_bound.push_back(next_point);
Expand Down

0 comments on commit 8e4a8c8

Please sign in to comment.