refactor(mpc_lateral_controller, trajectory_follower_node)!: prefix package and namespace with autoware #7306
CodeScene PR Check
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 29 findings(s) 🚩
Details
🚩 Declining Code Health (highest to lowest):
- Complex Conditional mpc.cpp: MPC::isValid
- Complex Conditional mpc_lateral_controller.cpp: MpcLateralController::isValidTrajectory
- Duplicated Assertion Blocks test_mpc.cpp: TEST:MPCTest:MultiSolveWithBuffer
- Complex Conditional mpc_trajectory.cpp: MPCTrajectory::size
- Overall Code Complexity mpc.cpp
- Code Duplication test_mpc.cpp
- Large Method mpc.cpp: MPC::generateMPCMatrix
- Complex Conditional mpc_utils.cpp: calcNearestPoseInterp
- Complex Method mpc_utils.cpp: calcNearestPoseInterp
- Excess Number of Function Arguments mpc_trajectory.cpp: MPCTrajectory::push_back
- Primitive Obsession mpc_utils.cpp
- Excess Number of Function Arguments qp_solver_osqp.cpp: QPSolverOSQP::solve
- Excess Number of Function Arguments qp_solver_unconstraint_fast.cpp: QPSolverEigenLeastSquareLLT::solve
- Excess Number of Function Arguments vehicle_model_bicycle_dynamics.cpp: DynamicsBicycleModel::calculateDiscreteMatrix
- Excess Number of Function Arguments vehicle_model_bicycle_kinematics.cpp: KinematicsBicycleModel::calculateDiscreteMatrix
- Excess Number of Function Arguments vehicle_model_bicycle_kinematics_no_delay.cpp: KinematicsBicycleModelNoDelay::calculateDiscreteMatrix
- Complex Conditional mpc.cpp: MPC::setReferenceTrajectory
- Complex Method mpc_lateral_controller.cpp: MpcLateralController::isValidTrajectory
- Excess Number of Function Arguments mpc_utils.cpp: calcNearestPoseInterp
- Bumpy Road Ahead mpc.cpp: MPC::generateMPCMatrix
- Excess Number of Function Arguments mpc.cpp: MPC::calculateMPC
- Excess Number of Function Arguments mpc.cpp: MPC::executeOptimization
- Bumpy Road Ahead mpc_utils.cpp: calcStopDistance
- Bumpy Road Ahead steering_predictor.cpp: SteeringPredictor::getSteerCmdSum
- Complex Method mpc_lateral_controller.cpp: MpcLateralController::run
- Complex Method mpc.cpp: MPC::isValid
- Excess Number of Function Arguments mpc_utils.cpp: dynamicSmoothingVelocity
- Complex Method mpc.cpp: MPC::setReferenceTrajectory
- Complex Method mpc.cpp: MPC::calcSteerRateLimitOnTrajectory
Annotations
Check warning on line 829 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
MPC::isValid has a cyclomatic complexity of 17, 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 242 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
MPC::setReferenceTrajectory has a cyclomatic complexity of 11, 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 781 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
MPC::calcSteerRateLimitOnTrajectory 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 200 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
MPC::setReferenceTrajectory has 1 complex conditionals with 3 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 824 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
MPC::isValid has 2 complex conditionals with 14 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 520 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Large Method
MPC::generateMPCMatrix has 87 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 520 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
MPC::generateMPCMatrix 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 control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Overall Code Complexity
This module has a mean cyclomatic complexity of 4.84 across 19 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 115 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
MPC::calculateMPC has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 603 in control/autoware_mpc_lateral_controller/src/mpc.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
MPC::executeOptimization has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 642 in control/autoware_mpc_lateral_controller/src/mpc_lateral_controller.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
MpcLateralController::isValidTrajectory has a cyclomatic complexity of 14, 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 310 in control/autoware_mpc_lateral_controller/src/mpc_lateral_controller.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
MpcLateralController::run has a cyclomatic complexity of 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 warning on line 637 in control/autoware_mpc_lateral_controller/src/mpc_lateral_controller.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
MpcLateralController::isValidTrajectory has 1 complex conditionals with 11 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 93 in control/autoware_mpc_lateral_controller/src/mpc_trajectory.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
MPCTrajectory::size has 1 complex conditionals with 6 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 31 in control/autoware_mpc_lateral_controller/src/mpc_trajectory.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
MPCTrajectory::push_back has 8 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 413 in control/autoware_mpc_lateral_controller/src/mpc_utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
calcNearestPoseInterp has a cyclomatic complexity of 11, 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 337 in control/autoware_mpc_lateral_controller/src/mpc_utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
calcNearestPoseInterp has 1 complex conditionals with 3 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 445 in control/autoware_mpc_lateral_controller/src/mpc_utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
calcStopDistance 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 control/autoware_mpc_lateral_controller/src/mpc_utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Primitive Obsession
In this module, 32.1% 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 331 in control/autoware_mpc_lateral_controller/src/mpc_utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
dynamicSmoothingVelocity has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 413 in control/autoware_mpc_lateral_controller/src/mpc_utils.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
calcNearestPoseInterp has 7 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 82 in control/autoware_mpc_lateral_controller/src/qp_solver/qp_solver_osqp.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
QPSolverOSQP::solve has 8 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
QPSolverEigenLeastSquareLLT::solve has 8 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 103 in control/autoware_mpc_lateral_controller/src/steering_predictor.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
SteeringPredictor::getSteerCmdSum 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.
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
DynamicsBicycleModel::calculateDiscreteMatrix has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.