petspats/pyha

View on GitHub
pyha/common/complex.py

Summary

Maintainability
B
6 hrs
Test Coverage

Complex has 27 functions (exceeds 20 allowed). Consider refactoring.
Open

class Complex:
    """
    Complex number with ``.real`` and ``.imag`` elements. Default type is ``Complex(left=0, right=-17)``.

    :param val:
Severity: Minor
Found in pyha/common/complex.py - About 3 hrs to fix

    Function __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, val=0.0 + 0.0j, left=0, right=-17, overflow_style='wrap', round_style='truncate',
    Severity: Major
    Found in pyha/common/complex.py - About 1 hr to fix

      Function resize has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def resize(self, left=0, right=0, type=None, overflow_style='wrap', round_style='truncate', wrap_is_ok=False,
      Severity: Major
      Found in pyha/common/complex.py - About 50 mins to fix

        Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, val=0.0 + 0.0j, left=0, right=-17, overflow_style='wrap', round_style='truncate',
                         init_only=False, wrap_is_ok=False, signed=True, bits=None, upper_bits=None):
        
                self.upper_bits = upper_bits
                self.bits = bits
        Severity: Minor
        Found in pyha/common/complex.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