Skip to content

refactor(control): Remove unused variables and functions

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) failed Oct 2, 2023 in 58s

CodeScene PR Check

❌ Quality Gates: FAILED

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

Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene

Details

🚩 Negative Code Health Impact (highest to lowest):

  • Large Method vehicle_cmd_gate.cpp: VehicleCmdGate::VehicleCmdGate
  • Complex Method vehicle_cmd_gate.cpp: VehicleCmdGate::publishControlCommands
  • Bumpy Road Ahead vehicle_cmd_gate.cpp: VehicleCmdGate::publishControlCommands

βœ… Positive Code Health Impact (highest to lowest):

  • Complex Method pid_longitudinal_controller.cpp: PidLongitudinalController::updateControlState
  • Large Method pid_longitudinal_controller.cpp: diagnostic_updater_
  • Complex Method mpc_lateral_controller.cpp: MpcLateralController::run

Annotations

Check warning on line 447 in control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp

See this annotation in the file changed.

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

❌ Getting worse: Complex Method

VehicleCmdGate::publishControlCommands increases in cyclomatic complexity from 12 to 16, 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 165 in control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp

See this annotation in the file changed.

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

❌ Getting worse: Large Method

VehicleCmdGate::VehicleCmdGate increases from 152 to 155 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 447 in control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp

See this annotation in the file changed.

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

❌ New issue: Bumpy Road Ahead

VehicleCmdGate::publishControlCommands 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 276 in control/mpc_lateral_controller/src/mpc_lateral_controller.cpp

See this annotation in the file changed.

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

βœ… Getting better: Complex Method

MpcLateralController::run decreases in cyclomatic complexity from 10 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 496 in control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp

See this annotation in the file changed.

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

βœ… Getting better: Complex Method

PidLongitudinalController::updateControlState decreases in cyclomatic complexity from 33 to 32, 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 51 in control/pid_longitudinal_controller/src/pid_longitudinal_controller.cpp

See this annotation in the file changed.

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

βœ… Getting better: Large Method

diagnostic_updater_ decreases from 116 to 114 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.