Hrabal/TemPy

View on GitHub
tempy/modifier.py

Summary

Maintainability
C
1 day
Test Coverage

Function wrap_many has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def wrap_many(self, *args, strict=False):
        """Wraps different copies of this element inside all empty tags
        listed in params or param's (non-empty) iterators.
        Returns list of copies of this element wrapped inside args
        or None if not succeeded, in the same order and same structure,
Severity: Minor
Found in tempy/modifier.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 _insert has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def _insert(self, dom_group, idx=None, prepend=False, name=None):
        """Inserts a DOMGroup inside this element.
        If provided at the given index, if prepend at the start of the childs list, by default at the end.
        If the child is a DOMElement, correctly links the child.
        If the DOMGroup have a name, an attribute containing the child is created in this instance.
Severity: Minor
Found in tempy/modifier.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 pop has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def pop(self, arg=None):
        """Removes the child at given position or by name (or name iterator).
            if no argument is given removes the last."""
        if arg is None:
            arg = len(self.childs) - 1
Severity: Minor
Found in tempy/modifier.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

There are no issues that match your filters.

Category
Status