avocado-framework/avocado

View on GitHub
avocado/core/tree.py

Summary

Maintainability
D
1 day
Test Coverage
B
82%

File tree.py has 459 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Severity: Minor
Found in avocado/core/tree.py - About 7 hrs to fix

    TreeNode has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TreeNode:
        """
        Class for bounding nodes into tree-structure.
        """
    
    
    Severity: Minor
    Found in avocado/core/tree.py - About 2 hrs to fix

      Function process_node has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_node(node):
              """
              Generate this node's tree-view
              :return: list of lines
              """
      Severity: Minor
      Found in avocado/core/tree.py - About 2 hrs to fix

      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 get_environment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_environment(self):
              """Get node environment (values + preceding envs)"""
              if self._environment is None:
                  self._environment = (
                      self.parent.environment.copy() if self.parent else TreeEnvironment()
      Severity: Minor
      Found in avocado/core/tree.py - About 1 hr to fix

      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 __eq__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __eq__(self, other):
              """Compares node to other node or string to name of this node"""
              if isinstance(other, str):  # Compare names
                  if self.name == other:
                      return True
      Severity: Minor
      Found in avocado/core/tree.py - About 55 mins to fix

      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 get_node has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_node(self, path, create=False):
              """
              :param path: Path of the desired node (relative to this node)
              :param create: Create the node (and intermediary ones) when not present
              :return: the node associated with this path
      Severity: Minor
      Found in avocado/core/tree.py - About 55 mins to fix

      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 __hash__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def __hash__(self):
              values = []
              for item in self.value:
                  try:
                      values.append(hash(item))
      Severity: Minor
      Found in avocado/core/tree.py - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status