Hrabal/TemPy

View on GitHub
tempy/content.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function apply_function has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def apply_function(self, format_function):
        for index, content in enumerate(filter(lambda c: c is not None, self.content)):
            if isinstance(content, DOMElement):
                content.apply_function(format_function)
            elif self._t_repr:
Severity: Minor
Found in tempy/content.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 content has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def content(self):
        content = self._fixed_content
        if not content and self.parent:
            content = self.parent.find_content(self._name)
        if isinstance(content, DOMElement) or content:
Severity: Minor
Found in tempy/content.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 render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def render(self, *args, **kwargs):
        pretty = kwargs.pop("pretty", False)
        ret = []
        for content in self.content:
            if content is None:
Severity: Minor
Found in tempy/content.py - About 45 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