feat(avoidance): suppress unnecessary avoidance path #5387
CodeScene PR Check
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 2 findings(s) 🚩
- Improving Code Health: 7 findings(s) ✅
- Affected Hotspots: 2 files(s) 🔥
Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene
Details
🚩 Declining Code Health (highest to lowest):
- Complex Method manager.cpp: AvoidanceModuleManager::AvoidanceModuleManager
- Large Method avoidance_module.cpp: AvoidanceModule::updateDebugMarker 🔥
✅ Improving Code Health:
- Overall Code Complexity utils.cpp 🔥
- Complex Method utils.cpp: filterTargetObjects 🔥
- Deep, Nested Complexity utils.cpp: filterTargetObjects 🔥
- Bumpy Road Ahead utils.cpp: filterTargetObjects 🔥
- Complex Conditional utils.cpp: filterTargetObjects 🔥
- Excess Number of Function Arguments utils.cpp: filterTargetObjects 🔥
- Brain Method utils.cpp: filterTargetObjects 🔥
Annotations
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 2234 to 2237, 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.
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Large Method
AvoidanceModule::updateDebugMarker increases from 107 to 108 lines of code, 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 118 in planning/behavior_path_planner/src/scene_module/avoidance/manager.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Complex Method
AvoidanceModuleManager::AvoidanceModuleManager already has high cyclomatic complexity, and now it increases in Lines of Code from 257 to 259. 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 1 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 1471 to 1550, 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 1450 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Complex Method
filterTargetObjects decreases in cyclomatic complexity from 58 to 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 notice on line 436 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ New issue: Complex Method
isObjectOnRoadShoulder 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 notice on line 1438 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Conditional
filterTargetObjects 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 336 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ New issue: Complex Conditional
isObjectOnRoadShoulder 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 notice on line 1450 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Bumpy Road Ahead
filterTargetObjects decreases from 8 to 3 logical blocks with deeply nested code, threshold is one single 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 436 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ New issue: Bumpy Road Ahead
isObjectOnRoadShoulder 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_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 5.35 to 4.67, 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 1450 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Deep, Nested Complexity
filterTargetObjects 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 notice on line 1450 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Excess Number of Function Arguments
filterTargetObjects 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.
Check notice on line 1450 in planning/behavior_path_planner/src/utils/avoidance/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Brain Method
filterTargetObjects is no longer a brain method