feat(emergency_handler): change to read topic by polling #7184
CodeScene PR Check
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 14 findings(s) 🚩
- Improving Code Health: 10 findings(s) ✅
- Affected Hotspots: 3 files(s) 🔥
Details
🚩 Declining Code Health (highest to lowest):
- Complex Method ndt_scan_matcher_core.cpp: NDTScanMatcher::callback_sensor_points_main
- Large Method node.cpp: BehaviorVelocityPlannerNode::BehaviorVelocityPlannerNode
- Complex Method route_handler.cpp: RouteHandler::getLaneletSequenceUpTo
- Complex Method route_handler.cpp: RouteHandler::getCheckTargetLanesFromPath
- Complex Method node.cpp: BehaviorVelocityPlannerNode::isDataReady
- Primitive Obsession planning_interface_test_manager.cpp
- String Heavy Function Arguments planning_interface_test_manager.cpp
- Complex Method node.cpp: ObstacleCruisePlannerNode::checkConsistency
- Complex Method route_handler.cpp: RouteHandler::getRelation
- Complex Method route_handler.cpp: RouteHandler::getLaneChangeableDistance
- Complex Method route_handler.cpp: RouteHandler::getFurthestLinestring
- Complex Method scene.cpp: AvoidanceModule::updateEgoBehavior 🔥
- Complex Method scene.cpp: AvoidanceModule::isSatisfiedSuccessCondition 🔥
- Bumpy Road Ahead landmark_manager.cpp: LandmarkManager::calculate_new_self_pose
✅ Improving Code Health:
- Lines of Code in a Single File utils.cpp 🔥
- Overall Code Complexity utils.cpp 🔥
- Lines of Code in a Single File start_planner_module.cpp 🔥
- Lines of Code in a Single File node.cpp
- Complex Method utils.cpp: getSafetyCheckTargetObjects 🔥
- Complex Method scene.cpp: AvoidanceModule::plan 🔥
- Complex Method default_planner.cpp: DefaultPlanner::is_goal_valid
- Complex Method scene.cpp: AvoidanceModule::getCurrentModuleState 🔥
- Complex Method start_planner_module.cpp: StartPlannerModule::updateData 🔥
- Bumpy Road Ahead default_planner.cpp: DefaultPlanner::is_goal_valid
Annotations
Check notice on line 1 in planning/obstacle_cruise_planner/src/node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Lines of Code in a Single File
The lines of code decreases from 1240 to 1235, 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 warning on line 1425 in planning/obstacle_cruise_planner/src/node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
ObstacleCruisePlannerNode::checkConsistency 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 notice on line 1425 in planning/obstacle_cruise_planner/src/node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Bumpy Road Ahead
ObstacleCruisePlannerNode::checkConsistency increases from 2 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 1 in planning/obstacle_cruise_planner/src/node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 4.37 to 4.42, 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/obstacle_cruise_planner/src/node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Primitive Obsession
The ratio of primitive types in function arguments increases from 30.91% to 32.69%, 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 warning on line 477 in localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Complex Method
NDTScanMatcher::callback_sensor_points_main already has high cyclomatic complexity, and now it increases in Lines of Code from 239 to 242. 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 380 in planning/mission_planner/src/lanelet2_plugins/default_planner.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Complex Method
DefaultPlanner::is_goal_valid decreases in cyclomatic complexity from 15 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 380 in planning/mission_planner/src/lanelet2_plugins/default_planner.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Bumpy Road Ahead
DefaultPlanner::is_goal_valid decreases from 3 to 2 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.
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
LandmarkManager::calculate_new_self_pose 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_avoidance_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 1223 to 1241, 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 945 in planning/behavior_path_avoidance_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Complex Method
AvoidanceModule::plan decreases in cyclomatic complexity from 13 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 155 in planning/behavior_path_avoidance_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Method
AvoidanceModule::getCurrentModuleState 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 688 in planning/behavior_path_avoidance_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
AvoidanceModule::updateEgoBehavior 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 warning on line 155 in planning/behavior_path_avoidance_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
AvoidanceModule::isSatisfiedSuccessCondition 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 1 in planning/behavior_path_avoidance_module/src/scene.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 5.15 to 5.19, 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_avoidance_module/src/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Lines of Code in a Single File
The lines of code decreases from 1798 to 1793, 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 1913 in planning/behavior_path_avoidance_module/src/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Complex Method
getSafetyCheckTargetObjects decreases in cyclomatic complexity from 21 to 20, 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 1 in planning/behavior_path_avoidance_module/src/utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 5.08 to 5.07, 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_start_planner_module/src/start_planner_module.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Lines of Code in a Single File
The lines of code decreases from 1359 to 1352, 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 249 in planning/behavior_path_start_planner_module/src/start_planner_module.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Complex Method
StartPlannerModule::updateData decreases in cyclomatic complexity from 11 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 warning on line 1 in planning/planning_test_utils/src/planning_interface_test_manager.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Primitive Obsession
In this module, 45.3% of all function arguments are primitive types, 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 warning on line 1 in planning/planning_test_utils/src/planning_interface_test_manager.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: String Heavy Function Arguments
In this module, 43.2% of all arguments to its 62 functions are strings. The threshold for string arguments is 39.0%. The functions in this file have a high ratio of strings as arguments. Avoid adding more.
Check warning on line 224 in planning/behavior_velocity_planner/src/node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
BehaviorVelocityPlannerNode::isDataReady 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 warning on line 163 in planning/behavior_velocity_planner/src/node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Large Method
BehaviorVelocityPlannerNode::BehaviorVelocityPlannerNode has 74 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 1 in planning/route_handler/src/route_handler.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 1609 to 1929, 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.