File varianter_yaml_to_mux.py
has 418 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 initialize
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def initialize(self, config):
subcommand = config.get("subcommand")
data = None
# Merge the multiplex
- 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 _mapping_to_tree_loader
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _mapping_to_tree_loader(loader, node, looks_like_node=False):
"""Maps yaml mapping tag to TreeNode structure"""
_value = []
for key_node, value_node in node.value:
# Allow only strings as dict keys
- 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 _handle_control_tag
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _handle_control_tag(path, node, value):
"""
Handling of most YAML control tags (all but "!using")
:param path: path on the YAML
- 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 _node_content_from_dict
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _node_content_from_dict(path, node, values, using):
"""Processes dict values into the current node content"""
for key, value in values.items():
if isinstance(key, mux.Control):
if key.code == YAML_USING:
- 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 _create_from_yaml
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _create_from_yaml(path):
"""Create tree structure from yaml stream"""
# Parse file name ([$using:]$path)
path = __RE_FILE_SPLIT.split(path, 1)
- 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 _node_content_from_node
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _node_content_from_node(path, node, values, using):
"""Processes node values into the current node content"""
for value in values:
if isinstance(value, mux.MuxTreeNode):
node.add_child(value)
- 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 _apply_using
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _apply_using(name, using, node):
"""
Create the structure defined by "!using" and return the new root
:param name: the tag name to have the "!using" applied to
- 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 create_from_yaml
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_from_yaml(paths):
"""Create tree structure from yaml-like file.
:param paths: File object to be processed
:raise SyntaxError: When yaml-file is corrupted
- 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"