Skip to content

refactor(goal_planner): move decision_state implementation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) failed Dec 2, 2024 in 37s

CodeScene PR Check

❌ Code Health Quality Gates: FAILED

Change in average Code Health of affected files: +0.61 (2.68 -> 3.29)

  • Declining Code Health: 4 findings(s) 🚩
  • Improving Code Health: 6 findings(s) βœ…
  • Affected Hotspots: 1 files(s) πŸ”₯

View detailed results in CodeScene

Details

🚩 Declining Code Health (highest to lowest):

  • Complex Method decision_state.cpp: PathDecisionStateController::get_next_state
  • Complex Conditional decision_state.cpp: PathDecisionStateController::get_next_state
  • Excess Number of Function Arguments decision_state.cpp: PathDecisionStateController::transit_state
  • Bumpy Road Ahead decision_state.cpp: PathDecisionStateController::get_next_state

βœ… Improving Code Health:

  • Lines of Code in a Single File goal_planner_module.cpp πŸ”₯
  • Overall Code Complexity goal_planner_module.cpp πŸ”₯
  • Complex Conditional goal_planner_module.cpp: PathDecisionStateController::get_next_state πŸ”₯
  • Complex Method goal_planner_module.cpp: PathDecisionStateController::get_next_state πŸ”₯
  • Bumpy Road Ahead goal_planner_module.cpp: PathDecisionStateController::get_next_state πŸ”₯
  • Excess Number of Function Arguments goal_planner_module.cpp: PathDecisionStateController::transit_state πŸ”₯

Annotations

Check warning on line 185 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/decision_state.cpp

See this annotation in the file changed.

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

❌ New issue: Complex Method

PathDecisionStateController::get_next_state has a cyclomatic complexity of 19, 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 90 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/decision_state.cpp

See this annotation in the file changed.

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

❌ New issue: Complex Conditional

PathDecisionStateController::get_next_state 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 185 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/decision_state.cpp

See this annotation in the file changed.

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

❌ New issue: Bumpy Road Ahead

PathDecisionStateController::get_next_state 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 41 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/decision_state.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

PathDecisionStateController::transit_state has 13 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.

Check notice on line 1 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

See this annotation in the file changed.

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

βœ… Getting better: Lines of Code in a Single File

The lines of code decreases from 2005 to 1871, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.

Check notice on line 2606 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.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

PathDecisionStateController::get_next_state 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 2606 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.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

PathDecisionStateController::get_next_state no longer has a complex conditional. 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 notice on line 2606 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.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

PathDecisionStateController::get_next_state 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 planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

See this annotation in the file changed.

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

βœ… Getting better: Overall Code Complexity

The mean cyclomatic complexity decreases from 6.44 to 6.31, 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 2606 in planning/behavior_path_planner/autoware_behavior_path_goal_planner_module/src/goal_planner_module.cpp

See this annotation in the file changed.

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

βœ… No longer an issue: Excess Number of Function Arguments

PathDecisionStateController::transit_state is no longer above the threshold for number of arguments. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.