feat(reaction_analyzer): add reaction anaylzer tool to measure end-to-end delay in sudden obstacle braking response #5954
CodeScene PR Check
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 36 findings(s) 🚩
Details
🚩 Declining Code Health (highest to lowest):
- Code Duplication subscriber.cpp
- Complex Method subscriber.cpp: SubscriberBase::get_subscriber_variable
- Overall Code Complexity subscriber.cpp
- Overall Code Complexity topic_publisher.cpp
- Deep, Nested Complexity utils.cpp: write_results
- Complex Method subscriber.cpp: SubscriberBase::find_first_brake_idx
- Complex Method topic_publisher.cpp: TopicPublisher::init_rosbag_publisher_buffer
- Complex Method utils.cpp: get_publisher_message_type
- Complex Method subscriber.cpp: SubscriberBase::on_control_command
- Complex Method subscriber.cpp: SubscriberBase::init_reaction_chains_and_params
- Complex Method reaction_analyzer_node.cpp: ReactionAnalyzerNode::init_test_env
- Large Method reaction_analyzer_node.cpp: Node
- Complex Method utils.cpp: write_results
- Complex Method topic_publisher.cpp: TopicPublisher::pointcloud_messages_sync_publisher
- Deep, Nested Complexity subscriber.cpp: SubscriberBase::on_control_command
- Excess Number of Function Arguments reaction_analyzer_node.cpp: ReactionAnalyzerNode::init_test_env
- Primitive Obsession subscriber.cpp
- Primitive Obsession utils.cpp
- Deep, Nested Complexity subscriber.cpp: SubscriberBase::find_first_brake_idx
- Bumpy Road Ahead reaction_analyzer_node.cpp: ReactionAnalyzerNode::init_test_env
- Bumpy Road Ahead topic_publisher.cpp: TopicPublisher::set_timers_for_pointcloud_msgs
- Complex Conditional subscriber.cpp: SubscriberBase::on_trajectory
- Complex Conditional subscriber.cpp: SubscriberBase::on_trajectory
- Complex Conditional subscriber.cpp: SubscriberBase::on_predicted_objects
- Complex Conditional subscriber.cpp: SubscriberBase::on_predicted_objects
- Complex Conditional subscriber.cpp: SubscriberBase::on_detected_objects
- Complex Conditional subscriber.cpp: SubscriberBase::on_detected_objects
- Complex Conditional subscriber.cpp: SubscriberBase::on_tracked_objects
- Complex Conditional subscriber.cpp: SubscriberBase::on_tracked_objects
- Bumpy Road Ahead subscriber.cpp: SubscriberBase::init_reaction_chains_and_params
- Bumpy Road Ahead subscriber.cpp: SubscriberBase::get_message_buffers_map
- Bumpy Road Ahead subscriber.cpp: SubscriberBase::find_first_brake_idx
- Bumpy Road Ahead utils.cpp: write_results
- Bumpy Road Ahead reaction_analyzer_node.cpp: ReactionAnalyzerNode::spawn_obstacle
- Bumpy Road Ahead reaction_analyzer_node.cpp: ReactionAnalyzerNode::calculate_results
- Bumpy Road Ahead topic_publisher.cpp: TopicPublisher::set_message
Annotations
Check warning on line 322 in tools/reaction_analyzer/src/reaction_analyzer_node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
ReactionAnalyzerNode::init_test_env 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 156 in tools/reaction_analyzer/src/reaction_analyzer_node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Large Method
Node has 81 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 322 in tools/reaction_analyzer/src/reaction_analyzer_node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
ReactionAnalyzerNode::init_test_env has 3 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 216 in tools/reaction_analyzer/src/reaction_analyzer_node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
ReactionAnalyzerNode::spawn_obstacle 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 251 in tools/reaction_analyzer/src/reaction_analyzer_node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
ReactionAnalyzerNode::calculate_results 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 322 in tools/reaction_analyzer/src/reaction_analyzer_node.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Excess Number of Function Arguments
ReactionAnalyzerNode::init_test_env has 5 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check warning on line 535 in tools/reaction_analyzer/src/topic_publisher.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
TopicPublisher::init_rosbag_publisher_buffer has a cyclomatic complexity of 18, 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 155 in tools/reaction_analyzer/src/topic_publisher.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
TopicPublisher::pointcloud_messages_sync_publisher 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 446 in tools/reaction_analyzer/src/topic_publisher.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
TopicPublisher::set_timers_for_pointcloud_msgs has 3 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 302 in tools/reaction_analyzer/src/topic_publisher.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
TopicPublisher::set_message 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 tools/reaction_analyzer/src/topic_publisher.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Overall Code Complexity
This module has a mean cyclomatic complexity of 5.92 across 13 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 373 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Code Duplication
The module contains 7 functions with similar structure: SubscriberBase::on_detected_objects,SubscriberBase::on_detected_objects,SubscriberBase::on_pointcloud,SubscriberBase::on_pointcloud and 3 more functions. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
Check warning on line 916 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
SubscriberBase::get_subscriber_variable 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 975 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
SubscriberBase::find_first_brake_idx 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 244 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
SubscriberBase::on_control_command 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 125 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
SubscriberBase::init_reaction_chains_and_params 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 259 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_trajectory has 1 complex conditionals with 2 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 298 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_trajectory has 1 complex conditionals with 2 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 435 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_predicted_objects has 1 complex conditionals with 2 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 466 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_predicted_objects has 1 complex conditionals with 2 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 494 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_detected_objects has 1 complex conditionals with 2 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 545 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_detected_objects has 1 complex conditionals with 2 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 594 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_tracked_objects has 1 complex conditionals with 2 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 619 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Conditional
SubscriberBase::on_tracked_objects has 1 complex conditionals with 2 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 125 in tools/reaction_analyzer/src/subscriber.cpp
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
SubscriberBase::init_reaction_chains_and_params 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.