Skip to content

Refactor fusion_node.hpp and fusion_node.cpp for improved code organi…

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main) failed Dec 26, 2024 in 42s

CodeScene PR Check

❌ Code Health Quality Gates: FAILED

Change in average Code Health of affected files: +0.17 (8.42 -> 8.59)

  • Declining Code Health: 1 findings(s) 🚩
  • Improving Code Health: 6 findings(s) βœ…

View detailed results in CodeScene

Details

🚩 Declining Code Health (highest to lowest):

  • Overall Code Complexity fusion_node.cpp

βœ… Improving Code Health:

  • Complex Method fusion_node.cpp: subCallback
  • Complex Method fusion_node.cpp: roiCallback
  • Bumpy Road Ahead fusion_node.cpp: subCallback
  • Bumpy Road Ahead fusion_node.cpp: roiCallback
  • Deep, Nested Complexity fusion_node.cpp: subCallback
  • Deep, Nested Complexity fusion_node.cpp: roiCallback

Annotations

Check notice on line 366 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

See this annotation in the file changed.

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

βœ… Getting better: Complex Method

subCallback decreases in cyclomatic complexity from 20 to 19, 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 430 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

See this annotation in the file changed.

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

βœ… Getting better: Complex Method

roiCallback 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 366 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

See this annotation in the file changed.

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

βœ… Getting better: Bumpy Road Ahead

subCallback decreases from 5 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 430 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

See this annotation in the file changed.

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

βœ… No longer an issue: Bumpy Road Ahead

roiCallback 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 warning on line 1 in perception/autoware_image_projection_based_fusion/src/fusion_node.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 6.29 across 7 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 notice on line 366 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

See this annotation in the file changed.

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

βœ… No longer an issue: Deep, Nested Complexity

subCallback is no longer above the threshold for nested complexity depth

Check notice on line 430 in perception/autoware_image_projection_based_fusion/src/fusion_node.cpp

See this annotation in the file changed.

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

βœ… No longer an issue: Deep, Nested Complexity

roiCallback is no longer above the threshold for nested complexity depth

Check notice on line 153 in perception/autoware_image_projection_based_fusion/src/roi_cluster_fusion/node.cpp

See this annotation in the file changed.

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

β„Ή Getting worse: Complex Method

RoiClusterFusionNode::fuseOnSingleImage already has high cyclomatic complexity, and now it increases in Lines of Code from 117 to 118. 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 166 in perception/autoware_image_projection_based_fusion/src/roi_detected_object_fusion/node.cpp

See this annotation in the file changed.

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

β„Ή Getting worse: Complex Method

RoiDetectedObjectFusionNode::generateDetectedObjectRoIs already has high cyclomatic complexity, and now it increases in Lines of Code from 75 to 76. 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.