Skip to content

fix: avoid zero division on the slope estimation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) failed Nov 25, 2024 in 57s

CodeScene PR Check

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: +0.58 (6.67 -> 7.25)

  • Declining Code Health: 11 findings(s) 🚩
  • Improving Code Health: 5 findings(s) ✅

View detailed results in CodeScene

Details

🚩 Declining Code Health (highest to lowest):

  • Overall Code Complexity grid_ground_filter.cpp
  • Deep, Nested Complexity grid_ground_filter.cpp: GridGroundFilter::classify
  • Complex Method grid_ground_filter.cpp: GridGroundFilter::classify
  • Complex Method grid_ground_filter.cpp: GridGroundFilter::initializeGround
  • Large Method node.cpp: ScanGroundFilterComponent::ScanGroundFilterComponent
  • Complex Method grid_ground_filter.cpp: GridGroundFilter::SegmentDiscontinuousCell
  • Complex Conditional grid_ground_filter.cpp: GridGroundFilter::classify
  • Complex Method grid_ground_filter.cpp: GridGroundFilter::SegmentContinuousCell
  • Complex Method grid_ground_filter.cpp: GridGroundFilter::SegmentBreakCell
  • Bumpy Road Ahead grid_ground_filter.cpp: GridGroundFilter::classify
  • Bumpy Road Ahead grid_ground_filter.cpp: GridGroundFilter::initializeGround

✅ Improving Code Health:

  • Deep, Nested Complexity node.cpp: ScanGroundFilterComponent::classifyPointCloudGridScan
  • Complex Method node.cpp: ScanGroundFilterComponent::classifyPointCloudGridScan
  • Bumpy Road Ahead node.cpp: ScanGroundFilterComponent::classifyPointCloudGridScan
  • Code Duplication node.cpp
  • Complex Conditional node.cpp: ScanGroundFilterComponent::classifyPointCloudGridScan

Annotations

Check notice on line 1 in perception/autoware_ground_segmentation/src/scan_ground_filter/node.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Code Duplication

The module no longer contains too many functions with similar structure

Check notice on line 192 in perception/autoware_ground_segmentation/src/scan_ground_filter/node.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Complex Method

ScanGroundFilterComponent::classifyPointCloudGridScan is no longer above the threshold for cyclomatic complexity. 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 notice on line 192 in perception/autoware_ground_segmentation/src/scan_ground_filter/node.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Complex Conditional

ScanGroundFilterComponent::classifyPointCloudGridScan no longer has a complex conditional

Check warning on line 129 in perception/autoware_ground_segmentation/src/scan_ground_filter/node.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Large Method

ScanGroundFilterComponent::ScanGroundFilterComponent has 70 lines, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.

Check notice on line 192 in perception/autoware_ground_segmentation/src/scan_ground_filter/node.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Bumpy Road Ahead

ScanGroundFilterComponent::classifyPointCloudGridScan is no longer above the threshold for logical blocks with deeply nested code. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check notice on line 1 in perception/autoware_ground_segmentation/src/scan_ground_filter/node.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

ℹ Getting worse: Overall Code Complexity

The mean cyclomatic complexity increases from 6.17 to 6.63, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.

Check notice on line 192 in perception/autoware_ground_segmentation/src/scan_ground_filter/node.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

✅ No longer an issue: Deep, Nested Complexity

ScanGroundFilterComponent::classifyPointCloudGridScan is no longer above the threshold for nested complexity depth. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.

Check warning on line 436 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

GridGroundFilter::classify has a cyclomatic complexity of 23, 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 169 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

GridGroundFilter::initializeGround has a cyclomatic complexity of 16, 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 283 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

GridGroundFilter::SegmentDiscontinuousCell has a cyclomatic complexity of 14, 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 225 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

GridGroundFilter::SegmentContinuousCell has a cyclomatic complexity of 12, 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 327 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Method

GridGroundFilter::SegmentBreakCell has a cyclomatic complexity of 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.

Check warning on line 393 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Complex Conditional

GridGroundFilter::classify 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.

Check warning on line 436 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Bumpy Road Ahead

GridGroundFilter::classify has 4 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check warning on line 169 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Bumpy Road Ahead

GridGroundFilter::initializeGround has 3 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.

Check warning on line 1 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Overall Code Complexity

This module has a mean cyclomatic complexity of 9.10 across 10 functions. The mean complexity threshold is 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.

Check warning on line 436 in perception/autoware_ground_segmentation/src/scan_ground_filter/grid_ground_filter.cpp

See this annotation in the file changed.

@codescene-delta-analysis codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)

❌ New issue: Deep, Nested Complexity

GridGroundFilter::classify has a nested complexity depth of 4, threshold = 4. This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health.