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
- 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
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
- 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 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):
- 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 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
- 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"