Nikolay-Lysenko/dodecaphony

View on GitHub

Showing 27 of 27 total issues

Function set_pitches_of_lower_lines has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def set_pitches_of_lower_lines(
        fragment: Fragment, max_interval: int = 16, default_shift: int = 7
) -> Fragment:
    """
    Set exact pitches of events from all melodic lines except the upper one.
Severity: Minor
Found in dodecaphony/fragment.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 find_indices_of_dissonating_events has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

def find_indices_of_dissonating_events(
        sonority: list[Event], meter_numerator: int
) -> tuple[set[int], set[int]]:
    """
    Find indices of dissonating (i.e., dependent, non-free in terms of strict counterpoint) events.
Severity: Minor
Found in dodecaphony/evaluation.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 validate_initialized_content has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def validate_initialized_content(params: FragmentParams) -> None:
    """
    Validate parameters related to initialized parts of temporal content and sonic content.

    :param params:
Severity: Minor
Found in dodecaphony/fragment.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 create_initial_sonic_content has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def create_initial_sonic_content(
        params: FragmentParams, temporal_content: list[list[float]]
) -> list[list[str]]:
    """
    Create initial data structure that keeps track of pitch classes.
Severity: Minor
Found in dodecaphony/fragment.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 calculate_durations_of_measures has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def calculate_durations_of_measures(fragment: Fragment) -> list[list[list[float]]]:
    """
    Calculate durations of measures.

    :param fragment:
Severity: Minor
Found in dodecaphony/fragment.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 find_sonority_type has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def find_sonority_type(
        sonority_start: float, sonority_end: float, regular_positions: list[dict[str, Any]],
        ad_hoc_positions: list[dict[str, Any]], n_beats: int
) -> str:
    """
Severity: Minor
Found in dodecaphony/evaluation.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_dissonances_preparation_and_resolution has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def evaluate_dissonances_preparation_and_resolution(
        fragment: Fragment,
        n_semitones_to_pt_and_ngh_preparation_penalty: dict[int, float],
        n_semitones_to_pt_and_ngh_resolution_penalty: dict[int, float],
        n_semitones_to_suspension_resolution_penalty: dict[int, float]
Severity: Minor
Found in dodecaphony/evaluation.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 get_mapping_from_pitch_class_to_diatonic_scales has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def get_mapping_from_pitch_class_to_diatonic_scales(
        scale_types: Optional[tuple[str]] = None
) -> dict[str, list[str]]:
    """
    Get mapping from pitch class to list of names of diatonic scales to which it belongs.
Severity: Minor
Found in dodecaphony/music_theory.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 create_tasks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def create_tasks(
        incumbent_solutions: list[Fragment],
        n_trials_per_iteration: int,
        paralleling_params: dict[str, Any]
) -> list[list[Task]]:
Severity: Minor
Found in dodecaphony/optimization.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_doubled_pitch_classes has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def evaluate_absence_of_doubled_pitch_classes(fragment: Fragment) -> float:
    """
    Evaluate absence of vertical intervals that are whole multipliers of octave.

    If the same pitch class sounds in two or more melodic lines simultaneously,
Severity: Minor
Found in dodecaphony/evaluation.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_voice_crossing has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def evaluate_absence_of_voice_crossing(
        fragment: Fragment, n_semitones_to_penalty: dict[int, float]
) -> float:
    """
    Evaluate absence of voice crossing.
Severity: Minor
Found in dodecaphony/evaluation.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 optimize_with_local_search has 12 arguments (exceeds 8 allowed). Consider refactoring.
Open

def optimize_with_local_search(
Severity: Major
Found in dodecaphony/optimization.py - About 1 hr to fix

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

    def evaluate_absence_of_simultaneous_skips(
            fragment: Fragment, min_skip_in_semitones: int = 5, max_skips_share: float = 0.65
    ) -> float:
        """
        Evaluate absence of simultaneous large enough skips.
    Severity: Minor
    Found in dodecaphony/evaluation.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 get_duration_changes has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_duration_changes() -> dict[tuple[float, float], list[tuple[float, float]]]:
        """
        Get mapping from durations of two events to list of pairs of durations of the same total sum.
    
        :return:
    Severity: Minor
    Found in dodecaphony/transformations.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

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

    def evaluate(
            fragment: Fragment,
            scoring_sets: list[str],
            scoring_sets_registry: SCORING_SETS_REGISTRY_TYPE,
            report: bool = False
    Severity: Minor
    Found in dodecaphony/evaluation.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

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

    def apply_pause_shift(fragment: Fragment) -> Fragment:
        """
        Shift a random pause one position to the left or to the right.
    
        :param fragment:
    Severity: Minor
    Found in dodecaphony/transformations.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

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

    def create_tsv_events_from_fragment(
            fragment: Fragment,
            events_path: str,
            beat_in_seconds: float,
            instruments: dict[int, str],
    Severity: Minor
    Found in dodecaphony/rendering.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

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

    def encode_line_intervals(melodic_lines: list[list[Event]]) -> list[str]:
        """
        Encode intervals from all melodic lines
    
        :param melodic_lines:
    Severity: Minor
    Found in dodecaphony/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

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

    def create_midi_from_fragment(
            fragment: Fragment,
            midi_path: str,
            beat_in_seconds: float,
            instruments: dict[int, int],
    Severity: Minor
    Found in dodecaphony/rendering.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

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

    def replace_instance(
            fragment: Fragment, group_index: int, instance_index: int, new_instance: list[str]
    ) -> Fragment:
        """
        Replace a particular sequence of 12 tones with another sequence of 12 tones.
    Severity: Minor
    Found in dodecaphony/transformations.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