refactor(autoware_tensorrt_common): multi-TensorRT compatibility & tensorrt_common as unified lib for all perception components #9762
CodeScene PR Check
❌ Code Health Quality Gates: FAILED
Change in average Code Health of affected files: +0.21 (7.26 -> 7.47)
- Declining Code Health: 20 findings(s) 🚩
- Improving Code Health: 13 findings(s) ✅
Details
🚩 Declining Code Health (highest to lowest):
- Code Duplication tensorrt_common.cpp
- Complex Method tensorrt_yolox.cpp: TrtYoloX::TrtYoloX
- Complex Method tensorrt_yolox.cpp: TrtYoloX::preprocessGpu
- Bumpy Road Ahead tensorrt_yolox.cpp: TrtYoloX::TrtYoloX
- Bumpy Road Ahead tensorrt_yolox.cpp: TrtYoloX::initPreprocessBuffer
- Bumpy Road Ahead tensorrt_yolox.cpp: TrtYoloX::preprocessGpu
- Large Method tensorrt_shape_estimator.cpp: TrtShapeEstimator::feed_forward_and_decode
- Complex Method tensorrt_classifier.cpp: TrtClassifier::TrtClassifier
- Complex Method tensorrt_yolox.cpp: TrtYoloX::initPreprocessBuffer
- Complex Method tensorrt_yolox.cpp: TrtYoloX::preprocessWithRoiGpu
- Complex Method tensorrt_classifier.cpp: TrtClassifier::preprocessGpu
- Complex Method tensorrt_classifier.cpp: TrtClassifier::initPreprocessBuffer
- Complex Method tensorrt_yolox.cpp: TrtYoloX::multiScalePreprocessGpu
- String Heavy Function Arguments tensorrt_classifier.cpp
- Bumpy Road Ahead tensorrt_yolox.cpp: TrtYoloX::preprocessWithRoiGpu
- Complex Method tensorrt_yolox.cpp: TrtYoloX::feedforwardAndDecode
- Bumpy Road Ahead tensorrt_yolox.cpp: TrtYoloX::multiScalePreprocessGpu
- Bumpy Road Ahead tensorrt_classifier.cpp: TrtClassifier::initPreprocessBuffer
- Bumpy Road Ahead tensorrt_classifier.cpp: TrtClassifier::preprocessGpu
- Bumpy Road Ahead tensorrt_classifier.cpp: TrtClassifier::TrtClassifier
✅ Improving Code Health:
- Large Method tensorrt_yolox_node.cpp: TrtYoloXNode::TrtYoloXNode
- Complex Method tensorrt_common.cpp: TrtCommon::setup
- Excess Number of Function Arguments tensorrt_classifier.cpp: TrtClassifier::TrtClassifier
- Complex Method tensorrt_common.cpp: TrtCommon::buildEngineFromOnnx
- Complex Method tensorrt_common.cpp: TrtCommon::printNetworkInfo
- Bumpy Road Ahead tensorrt_common.cpp: TrtCommon::buildEngineFromOnnx
- Bumpy Road Ahead tensorrt_common.cpp: TrtCommon::printNetworkInfo
- Large Method transfusion_trt.cpp: TransfusionTRT::preprocess
- Excess Number of Function Arguments tensorrt_shape_estimator.cpp: TrtShapeEstimator::TrtShapeEstimator
- Complex Conditional tensorrt_common.cpp: TrtCommon::buildEngineFromOnnx
- Overall Code Complexity tensorrt_common.cpp
- Deep, Nested Complexity tensorrt_common.cpp: TrtCommon::buildEngineFromOnnx
- String Heavy Function Arguments tensorrt_common.cpp
Annotations
Check notice on line 255 in perception/autoware_lidar_transfusion/lib/transfusion_trt.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Large Method
TransfusionTRT::preprocess is no longer above the threshold for lines of code
Check warning on line 225 in perception/autoware_shape_estimation/lib/tensorrt_shape_estimator.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Large Method
TrtShapeEstimator::feed_forward_and_decode increases from 79 to 82 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 66 in perception/autoware_shape_estimation/lib/tensorrt_shape_estimator.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Excess Number of Function Arguments
TrtShapeEstimator::TrtShapeEstimator is no longer above the threshold for number of arguments
Check warning on line 189 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Complex Method
TrtClassifier::TrtClassifier increases in cyclomatic complexity from 12 to 15, 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 294 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Complex Method
TrtClassifier::preprocessGpu increases in cyclomatic complexity from 11 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 warning on line 247 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Complex Method
TrtClassifier::initPreprocessBuffer increases in cyclomatic complexity from 11 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 warning on line 247 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Bumpy Road Ahead
TrtClassifier::initPreprocessBuffer 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 warning on line 294 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Bumpy Road Ahead
TrtClassifier::preprocessGpu 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 warning on line 189 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
TrtClassifier::TrtClassifier 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 perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 5.15 to 5.29, 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 perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Primitive Obsession
The ratio of primitive types in function arguments increases from 51.85% to 56.00%, 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 189 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Excess Number of Function Arguments
TrtClassifier::TrtClassifier decreases from 9 to 7 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 1 in perception/autoware_tensorrt_classifier/src/tensorrt_classifier.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: String Heavy Function Arguments
In this module, 40.0% of all arguments to its 14 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 232 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Code Duplication
introduced similar code in: TrtCommon::getIOTensorName,TrtCommon::getTensorShape,TrtCommon::setInputShape,TrtCommon::setTensorAddress. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
Check notice on line 242 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Complex Method
TrtCommon::setup decreases in cyclomatic complexity from 16 to 13, 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 547 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Method
TrtCommon::buildEngineFromOnnx 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 notice on line 330 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Method
TrtCommon::printNetworkInfo 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 notice on line 518 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ New issue: Complex Method
TrtCommon::initialize 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 notice on line 446 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Complex Conditional
TrtCommon::buildEngineFromOnnx no longer has a complex conditional
Check notice on line 242 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Bumpy Road Ahead
TrtCommon::setup increases from 3 to 4 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 547 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Bumpy Road Ahead
TrtCommon::buildEngineFromOnnx 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 notice on line 330 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Bumpy Road Ahead
TrtCommon::printNetworkInfo 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 notice on line 667 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ New issue: Bumpy Road Ahead
TrtCommon::validateNetworkIO 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 perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Overall Code Complexity
The mean cyclomatic complexity in this module is no longer above the threshold
Check notice on line 547 in perception/autoware_tensorrt_common/src/tensorrt_common.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Deep, Nested Complexity
TrtCommon::buildEngineFromOnnx is no longer above the threshold for nested complexity depth