Skip to content

fix(pid_longitudinal_controller): change pid structure with respect t…

This check has been archived and is scheduled for deletion. Learn more about checks retention
CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) failed Sep 26, 2023 in 1m 47s

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):

  • Overall Code Complexity pid_longitudinal_controller.cpp
  • Large Method test_longitudinal_controller_utils.cpp: TEST:TestLongitudinalControllerUtils:lerpTrajectoryPoint
  • Complex Method pid_longitudinal_controller.cpp: PidLongitudinalController::predictedStateAfterDelay

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

  • Large Method pid_longitudinal_controller.cpp: diagnostic_updater_
  • Primitive Obsession longitudinal_controller_utils.cpp
  • Complex Method pid_longitudinal_controller.cpp: PidLongitudinalController::predictedVelocityInTargetPoint

Annotations

Check notice on line 1 in control/pid_longitudinal_controller/src/longitudinal_controller_utils.cpp

See this annotation in the file changed.

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

βœ… Getting better: Primitive Obsession

The ratio of primitive types in function arguments decreases from 67.86% to 63.64%, 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 976 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)

βœ… No longer an issue: Complex Method

PidLongitudinalController::predictedVelocityInTargetPoint 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 976 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)

❌ New issue: Complex Method

PidLongitudinalController::predictedStateAfterDelay 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 165 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 115 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 1 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)

❌ New issue: Overall Code Complexity

This module has a mean cyclomatic complexity of 4.07 across 27 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 460 in control/pid_longitudinal_controller/test/test_longitudinal_controller_utils.cpp

See this annotation in the file changed.

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

❌ Getting worse: Large Method

TEST:TestLongitudinalControllerUtils:lerpTrajectoryPoint increases from 88 to 105 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 notice on line 63 in control/pid_longitudinal_controller/src/pid.cpp

See this annotation in the file changed.

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

β„Ή New issue: Excess Number of Function Arguments

PIDController::calculate has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.