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

test(no_stopping_area): refactor and add tests #9009

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from

disable failing checks for checkStopLinesInNoStoppingArea (need fix)

32aa3ed
Select commit
Loading
Failed to load commit list.
Draft

test(no_stopping_area): refactor and add tests #9009

disable failing checks for checkStopLinesInNoStoppingArea (need fix)
32aa3ed
Select commit
Loading
Failed to load commit list.
CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) failed Oct 4, 2024 in 51s

CodeScene PR Check

Code Health Quality Gates: FAILED

Change in average Code Health of affected files: +0.36 (8.59 -> 8.95)

  • Declining Code Health: 9 findings(s) 🚩
  • Improving Code Health: 6 findings(s) ✅

View detailed results in CodeScene

Absence of Expected Change Pattern

  • autoware.universe/planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/manager.cpp is usually changed with: autoware.universe/planning/behavior_velocity_planner/autoware_behavior_velocity_detection_area_module/src/manager.cpp

Details

🚩 Declining Code Health (highest to lowest):

  • Large Assertion Blocks test_utils.cpp
  • Overall Code Complexity utils.cpp
  • Large Method test_utils.cpp: TEST:NoStoppingAreaTest:generateEgoNoStoppingAreaLanePolygon
  • Complex Method utils.cpp: generate_ego_no_stopping_area_lane_polygon
  • Missing Arguments Abstractions utils.cpp
  • Bumpy Road Ahead utils.cpp: generate_ego_no_stopping_area_lane_polygon
  • Excess Number of Function Arguments utils.cpp: generate_ego_no_stopping_area_lane_polygon
  • Excess Number of Function Arguments utils.cpp: is_stoppable
  • Excess Number of Function Arguments utils.cpp: get_stop_line_geometry2d

✅ Improving Code Health:

  • Complex Method scene_no_stopping_area.cpp: NoStoppingAreaModule::generateEgoNoStoppingAreaLanePolygon
  • Bumpy Road Ahead debug.cpp: createLaneletInfoMarkerArray
  • Bumpy Road Ahead scene_no_stopping_area.cpp: NoStoppingAreaModule::checkStuckVehiclesInNoStoppingArea
  • Bumpy Road Ahead scene_no_stopping_area.cpp: NoStoppingAreaModule::generateEgoNoStoppingAreaLanePolygon
  • Complex Conditional scene_no_stopping_area.cpp: NoStoppingAreaModule::isTargetStuckVehicleType
  • Overall Code Complexity scene_no_stopping_area.cpp

Annotations

Check notice on line 121 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/debug.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

createLaneletInfoMarkerArray 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 121 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/debug.cpp

See this annotation in the file changed.

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

ℹ New issue: Bumpy Road Ahead

create_lanelet_info_marker_array has 2 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 notice on line 167 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.cpp

See this annotation in the file changed.

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

ℹ Getting worse: Complex Method

NoStoppingAreaModule::modifyPathVelocity already has high cyclomatic complexity, and now it increases in Lines of Code from 93 to 99. 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 205 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.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

NoStoppingAreaModule::generateEgoNoStoppingAreaLanePolygon 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 205 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.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

NoStoppingAreaModule::isTargetStuckVehicleType no longer has a complex conditional

Check notice on line 178 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.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

NoStoppingAreaModule::checkStuckVehiclesInNoStoppingArea 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 205 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.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

NoStoppingAreaModule::generateEgoNoStoppingAreaLanePolygon 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 205 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.cpp

See this annotation in the file changed.

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

ℹ New issue: Bumpy Road Ahead

NoStoppingAreaModule::check_stuck_vehicles_in_no_stopping_area has 2 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 notice on line 1 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/scene_no_stopping_area.cpp

See this annotation in the file changed.

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

✅ No longer an issue: Overall Code Complexity

The mean cyclomatic complexity in this module is no longer above the threshold

Check warning on line 204 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/utils.cpp

See this annotation in the file changed.

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

❌ New issue: Complex Method

generate_ego_no_stopping_area_lane_polygon has a cyclomatic complexity of 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.

Check warning on line 204 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/utils.cpp

See this annotation in the file changed.

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

❌ New issue: Bumpy Road Ahead

generate_ego_no_stopping_area_lane_polygon has 2 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 planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/utils.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 5.57 across 7 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 1 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/utils.cpp

See this annotation in the file changed.

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

❌ New issue: Missing Arguments Abstractions

The average number of function arguments in this module is 4.14 across 7 functions. The average arguments threshold is 4.00. The functions in this file have too many arguments, indicating a lack of encapsulation or too many responsibilities in the same functions. Avoid adding more.

Check warning on line 127 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/utils.cpp

See this annotation in the file changed.

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

❌ New issue: Excess Number of Function Arguments

is_stoppable has 6 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 204 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/utils.cpp

See this annotation in the file changed.

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

❌ New issue: Excess Number of Function Arguments

generate_ego_no_stopping_area_lane_polygon has 8 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 260 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/src/utils.cpp

See this annotation in the file changed.

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

❌ New issue: Excess Number of Function Arguments

get_stop_line_geometry2d has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check warning on line 354 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/test/test_utils.cpp

See this annotation in the file changed.

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

❌ New issue: Large Method

TEST:NoStoppingAreaTest:generateEgoNoStoppingAreaLanePolygon has 103 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 warning on line 438 in planning/behavior_velocity_planner/autoware_behavior_velocity_no_stopping_area_module/test/test_utils.cpp

See this annotation in the file changed.

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

❌ New issue: Large Assertion Blocks

The test suite contains 5 assertion blocks with at least 4 assertions, threshold = 4. This test file has several blocks of large, consecutive assert statements. Avoid adding more.