perf(lane_change): rework object filter #6847
CodeScene PR Check
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 2 findings(s) 🚩
- Improving Code Health: 9 findings(s) ✅
- Affected Hotspots: 4 files(s) 🔥
Details
🚩 Declining Code Health (highest to lowest):
- Complex Method scene.cpp: NormalLaneChange::filterObjectsByLanelets 🔥
- Complex Method scene.cpp: NormalLaneChange::filterObjects 🔥
✅ Improving Code Health:
- Overall Code Complexity scene.cpp 🔥
- Overall Code Complexity utils.cpp 🔥
- Overall Code Complexity utils.cpp 🔥
- Complex Method scene.cpp: NormalLaneChange::filterObject 🔥
- Complex Method scene.cpp: NormalLaneChange::isLaneChangePathSafe 🔥
- Primitive Obsession utils.cpp 🔥
- Primitive Obsession utils.cpp 🔥
- Bumpy Road Ahead scene.cpp: NormalLaneChange::filterObject 🔥
- Complex Conditional scene.cpp: NormalLaneChange::filterObject 🔥
Annotations
Check notice on line 1 in planning/behavior_path_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 1658 to 1683, 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 1961 in planning/behavior_path_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Complex Method
NormalLaneChange::isLaneChangePathSafe decreases in cyclomatic complexity from 12 to 9, 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 1110 in planning/behavior_path_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Method
NormalLaneChange::filterObject 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 warning on line 1110 in planning/behavior_path_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
NormalLaneChange::filterObjectsByLanelets 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 966 in planning/behavior_path_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
NormalLaneChange::filterObjects has a cyclomatic complexity of 9, 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 1103 in planning/behavior_path_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Conditional
NormalLaneChange::filterObject 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 1110 in planning/behavior_path_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Bumpy Road Ahead
NormalLaneChange::filterObject 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_lane_change_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 5.35 to 4.91, 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 1 in planning/behavior_path_lane_change_module/src/utils/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 4.20 to 4.18, 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 1 in planning/behavior_path_lane_change_module/src/utils/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Primitive Obsession
The ratio of primitive types in function arguments decreases from 33.33% to 32.68%, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Primitive Obsession
The ratio of primitive types in function arguments increases from 34.44% to 35.16%, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.
Check notice on line 1 in planning/behavior_path_start_planner_module/src/start_planner_module.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 1334 to 1336, 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 1 in planning/behavior_path_planner_common/src/utils/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 1302 to 1305, 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 1 in planning/behavior_path_planner_common/src/utils/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 4.48 to 4.41, 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 1 in planning/behavior_path_planner_common/src/utils/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Primitive Obsession
The ratio of primitive types in function arguments decreases from 31.14% to 30.99%, threshold = 30.0%. The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments.