Nikolay-Lysenko/rl-musician

View on GitHub

Showing 3 of 3 total issues

Function __init__ has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(
            self,
            tonic: str,
            scale_type: str,
            cantus_firmus: List[str],
Severity: Minor
Found in rlmusician/environment/piece.py - About 1 hr to fix

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

    def create_stubs(
            records: List[Record],
            n_stubs: int,
            stub_length: int,
            include_finalized_sequences: bool = True
    Severity: Minor
    Found in rlmusician/agent/monte_carlo_beam_search.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 evaluate_absence_of_looped_fragments has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def evaluate_absence_of_looped_fragments(
            piece: Piece, min_size: int = 4, max_size: Optional[int] = None
    ) -> float:
        """
        Evaluate non-triviality of a piece based on absence of looped fragments.
    Severity: Minor
    Found in rlmusician/environment/evaluation.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