Showing 15 of 15 total issues
Function _internal_prepare_next_tick
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def _internal_prepare_next_tick(self) -> None:
if(self.get_status() == NodeStatus.RUNNING):
if self._child_ec_list[self._child_ptr].instance is not None:
cur_child_state = self._child_ec_list[self._child_ptr].instance.get_status()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _internal_prepare_next_tick
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def _internal_prepare_next_tick(self) -> None:
if(self.get_status() == NodeStatus.RUNNING):
if self._child_ec_list[self._child_ptr].instance is not None:
cur_child_state = self._child_ec_list[self._child_ptr].instance.get_status()
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
TreeNode
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class TreeNode(ABC):
"""The careBT `TreeNode` class.
`TreeNode` is the basic class which provides the common implementation
for all careBT nodes.
Function _internal_tick_child_nodes
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _internal_tick_child_nodes(self, tick: bool) -> None:
if(tick is True):
for self._child_ptr, child_ec in enumerate(self._child_ec_list[:]):
if(child_ec.instance is not None):
self._internal_bind_in_params(child_ec)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function run
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def run(self, node: TreeNode, params: str = None) -> None:
"""Execute the provided node, respectively the provided behavior tree.
Parameters
----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, parent: TreeNode, node: TreeNode, params: str):
self.call_in_params: List[str] = []
self.call_out_params: List[str] = []
if(params is not None):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _internal_prepare_next_tick
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def _internal_prepare_next_tick(self) -> None:
if(self.get_status() != NodeStatus.ABORTED):
if(self._success_count >= self._success_threshold):
self.get_logger().debug('_success_count >= _success_threshold -- '
+ f'{self._success_count} >= {self._success_threshold}')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _internal_on_tick
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _internal_on_tick(self) -> None:
self.set_status(NodeStatus.RUNNING)
################################################
# create instance
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _internal_prepare_next_tick
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _internal_prepare_next_tick(self) -> None:
if(self.get_status() == NodeStatus.RUNNING):
cur_child_state = self._child_ec_list[0].instance.get_status()
# if the current child tick returned with FAILURE or ABORTED
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _internal_bind_out_params
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _internal_bind_out_params(self, child_ec: ExecutionContext) -> None:
for i, var in enumerate(child_ec.instance._internal_get_out_params()):
var = var.replace('?', '_', 1)
if(len(child_ec.call_out_params) > i):
if(getattr(child_ec.instance, var) is None):
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, bt_runner: 'BehaviorTreeRunner', params: str = None):
self.bt_runner = bt_runner
# PROTECTED
self._throttle_ms = None
self._last_ts = datetime.min
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid deeply nested control flow statements. Open
if(cur_child_state == NodeStatus.SUCCESS
or cur_child_state == NodeStatus.FIXED):
child_ec.instance._internal_on_delete()
child_ec.instance = None
self._success_count += 1
Function _internal_apply_contingencies
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _internal_apply_contingencies(self, child_ec: ExecutionContext):
self.get_logger().debug('searching contingency-handler for: '
+ f'{child_ec.instance.__class__.__name__} - '
+ f'{child_ec.instance.get_status()} - '
+ f'{child_ec.instance.get_contingency_message()}')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _internal_bind_in_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _internal_bind_in_params(self, child_ec: ExecutionContext) -> None:
if(len(child_ec.call_in_params) != len(child_ec.instance._internal_get_in_params())):
self.get_logger().warn(f'{child_ec.node.__name__} takes '
+ f'{len(child_ec.instance._internal_get_in_params())} '
+ f'argument(s), but {len(child_ec.call_in_params)} '
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _internal_on_abort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _internal_on_abort(self) -> None:
super()._internal_on_abort()
self.get_logger().info(f'aborting {self.__class__.__name__}')
if(self._child_ec_list[self._child_ptr].instance is not None):
self.set_status(NodeStatus.ABORTED)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"