avocado-framework/avocado

View on GitHub
optional_plugins/varianter_yaml_to_mux/avocado_varianter_yaml_to_mux/mux.py

Summary

Maintainability
D
1 day
Test Coverage
B
85%

Function merge has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def merge(self, other):
        """
        Merges `other` node into this one without checking the name of the
        other node. New values are appended, existing values overwritten
        and unaffected ones are kept. Then all other node children are

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

File mux.py has 317 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.
#

    Function _valid_variant has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def _valid_variant(variant):
            """
            Check the variant for validity of internal filters
    
            :return: whether the variant is valid or should be ignored/filtered

    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 regexp.match(child.name):
                                remove.append(child)
                        for child in remove:

      Avoid deeply nested control flow statements.
      Open

                              if regexp.match(key):
                                  remove.append(key)
                          for key in remove:

        Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, name="", value=None, parent=None, children=None):

          Function _iter_mux_leaves has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def _iter_mux_leaves(node):
                  """yield leaves or muxes of the tree"""
                  queue = collections.deque()
                  while node is not None:
                      if node.is_leaf or getattr(node, "multiplex", None):

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

              def iter_variants(self):
                  """
                  Iterates through variants without verifying the internal filters
          
                  :yield all existing variants

          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