LUXROBO/pymodi

View on GitHub
modi/util/topology_util.py

Summary

Maintainability
A
2 hrs
Test Coverage

Function __trim_map has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

        def __trim_map(self, raw_map: List):
            """
            Trims the matrix to get rid of empty spaces, containing zeros only
            """
            x, y, w, h = -1, -1, 1, 1
Severity: Minor
Found in modi/util/topology_util.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 __update_map has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

        def __update_map(self, module_id: int, x: int, y: int, prev_id: int,
Severity: Minor
Found in modi/util/topology_util.py - About 45 mins to fix

    Function __compose_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

            def __compose_line(self, module_id, padding, print_id):
                line = ""
                if not module_id:
                    line += " " * padding
                else:
    Severity: Minor
    Found in modi/util/topology_util.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