Hrabal/TemPy

View on GitHub
tempy/elements.py

Summary

Maintainability
B
5 hrs
Test Coverage

Tag has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class Tag(DOMElement):
    """
    Provides an api for tag inner manipulation and for rendering.
    """
    _template = "%s<%s%s>%s%s</%s>"
Severity: Minor
Found in tempy/elements.py - About 2 hrs to fix

Function render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def render(self, *args, **kwargs):
        """Renders the element and all his childrens."""
        # args kwargs API provided for last minute content injection
        # self._reverse_mro_func('pre_render')
        pretty = kwargs.pop("pretty", False)
Severity: Minor
Found in tempy/elements.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 attr has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def attr(self, *args, **kwargs):
        """Add an attribute to the element"""
        for key, value in kwargs.items():
            if key == "klass":
                self.attrs["klass"].update(value.split())
Severity: Minor
Found in tempy/elements.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 css has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def css(self, *props, **kwprops):
        """Adds css properties to this element."""
        if props:
            if len(props) == 1 and isinstance(props[0], Mapping):
                styles = props[0]
Severity: Minor
Found in tempy/elements.py - About 35 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 apply_function has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_function(self, format_function):
        for (index, child) in enumerate(self.childs):
            if child is not None:
                if isinstance(child, TempyClass):
                    child.apply_function(format_function)
Severity: Minor
Found in tempy/elements.py - About 35 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