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(autoware_probabilistic_occupancy_grid_map): fix bugprone-branch-clone #9652

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@
transformPointAndCalculate(pt, pt_map, angle_bin_index, range);

// Ignore obstacle points exceed the range of the raw points
if (raw_pointcloud_angle_bins.at(angle_bin_index).empty()) {
continue; // No raw point in this angle bin
} else if (range > raw_pointcloud_angle_bins.at(angle_bin_index).back().range) {
continue; // Obstacle point exceeds the range of the raw points
// No raw point in this angle bin, or obstacle point exceeds the range of the raw points
if (

Check warning on line 148 in perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_fixed.cpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_fixed.cpp#L148

Added line #L148 was not covered by tests
raw_pointcloud_angle_bins.at(angle_bin_index).empty() ||
range > raw_pointcloud_angle_bins.at(angle_bin_index).back().range) {
continue;

Check notice on line 151 in perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_fixed.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Complex Method

OccupancyGridMapFixedBlindSpot::updateWithPointCloud decreases in cyclomatic complexity from 38 to 37, 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.

Check warning on line 151 in perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_fixed.cpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_fixed.cpp#L151

Added line #L151 was not covered by tests
}
obstacle_pointcloud_angle_bins.at(angle_bin_index).emplace_back(range, pt_map[0], pt_map[1]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,11 @@
const double dz = scan_z - obstacle_z;

// Ignore obstacle points exceed the range of the raw points
if (raw_pointcloud_angle_bins.at(angle_bin_index).empty()) {
continue; // No raw point in this angle bin
} else if (range > raw_pointcloud_angle_bins.at(angle_bin_index).back().range) {
continue; // Obstacle point exceeds the range of the raw points
// No raw point in this angle bin, or obstacle point exceeds the range of the raw points
if (

Check warning on line 157 in perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_projective.cpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_projective.cpp#L157

Added line #L157 was not covered by tests
raw_pointcloud_angle_bins.at(angle_bin_index).empty() ||
range > raw_pointcloud_angle_bins.at(angle_bin_index).back().range) {
continue;

Check notice on line 160 in perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_projective.cpp

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Complex Method

OccupancyGridMapProjectiveBlindSpot::updateWithPointCloud decreases in cyclomatic complexity from 43 to 42, 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.

Check warning on line 160 in perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_projective.cpp

View check run for this annotation

Codecov / codecov/patch

perception/autoware_probabilistic_occupancy_grid_map/lib/costmap_2d/occupancy_grid_map_projective.cpp#L160

Added line #L160 was not covered by tests
}

if (dz > projection_dz_threshold_) {
Expand Down
Loading