pedrozath/coltrane

View on GitHub
lib/coltrane/representation/guitar/chord.rb

Summary

Maintainability
B
6 hrs
Test Coverage
B
88%

Class Chord has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

      class Chord
        include Comparable
        attr_reader :guitar_notes, :guitar, :free_fingers, :target_chord, :barre

        MAX_FRET_SPAN = 3
Severity: Minor
Found in lib/coltrane/representation/guitar/chord.rb - About 4 hrs to fix

    Method find_by_notation has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

            def self.find_by_notation(guitar, chord_notation)
              chord_notation
              .split('-')
              .map
              .with_index do |n, i|
    Severity: Minor
    Found in lib/coltrane/representation/guitar/chord.rb - 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

    Method fetch_descendant_chords has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

            def fetch_descendant_chords
              return [self] if guitar_notes.size >= guitar.strings.size
              possible_new_notes(notes_available.positive?).reduce([]) do |memo, n|
                barre = n.fret if guitar_notes.last == n.fret
                fingers_change = n.fret == barre || n.fret.zero? ? 0 : 1
    Severity: Minor
    Found in lib/coltrane/representation/guitar/chord.rb - 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

    There are no issues that match your filters.

    Category
    Status