opusonesolutions/carsons

View on GitHub

Showing 2 of 2 total issues

File carsons.py has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from collections import defaultdict
from itertools import islice
from typing import Dict, Iterable, Iterator, Tuple

from numpy import arctan, array, cos, exp, log, ndarray
Severity: Minor
Found in carsons/carsons.py - About 3 hrs to fix

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

        def __init__(self, model):
            self.phases: Iterable[str] = model.phases
            self.phase_positions: Dict[str, Tuple[float, float]] = model.wire_positions
            self.gmr: Dict[str, float] = model.geometric_mean_radius
            self.r: Dict[str, float] = model.resistance
    Severity: Minor
    Found in carsons/carsons.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

    Severity
    Category
    Status
    Source
    Language