roberthead/head_music

View on GitHub

Showing 16 of 20 total issues

Class PitchSet has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

class HeadMusic::PitchSet
  TERTIAN_SONORITIES = {
    implied_triad: [3],
    triad: [3, 5],
    seventh_chord: [3, 5, 7],
Severity: Minor
Found in lib/head_music/pitch_set.rb - About 4 hrs to fix

    Class Pitch has 36 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class HeadMusic::Pitch
      include Comparable
    
      attr_reader :spelling, :register
    
    
    Severity: Minor
    Found in lib/head_music/pitch.rb - About 4 hrs to fix

      File diatonic_interval.rb has 307 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class HeadMusic::DiatonicInterval
        include Comparable
      
        # TODO: include Named module
        NUMBER_NAMES = %w[
      Severity: Minor
      Found in lib/head_music/diatonic_interval.rb - About 3 hrs to fix

        Class Meter has 25 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class HeadMusic::Meter
          attr_reader :top_number, :bottom_number
        
          NAMED = {
            common_time: "4/4",
        Severity: Minor
        Found in lib/head_music/meter.rb - About 2 hrs to fix

          Class Annotation has 24 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class HeadMusic::Style::Annotation
            MESSAGE = "Write music."
          
            attr_reader :voice
          
          
          Severity: Minor
          Found in lib/head_music/style/annotation.rb - About 2 hrs to fix

            Class ConsonantClimax has 23 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class HeadMusic::Style::Guidelines::ConsonantClimax < HeadMusic::Style::Annotation
              MESSAGE = "Peak on a consonant high or low note one time or twice with a step between."
            
              def marks
                HeadMusic::Style::Mark.for_each(highest_notes) unless adherent_climax?
            Severity: Minor
            Found in lib/head_music/style/guidelines/consonant_climax.rb - About 2 hrs to fix

              Class Voice has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class HeadMusic::Content::Voice
                include Comparable
              
                attr_reader :composition, :placements, :role
              
              
              Severity: Minor
              Found in lib/head_music/content/voice.rb - About 2 hrs to fix

                Class DiatonicInterval has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class HeadMusic::DiatonicInterval
                  include Comparable
                
                  # TODO: include Named module
                  NUMBER_NAMES = %w[
                Severity: Minor
                Found in lib/head_music/diatonic_interval.rb - About 2 hrs to fix

                  Method to_s has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def to_s
                      if sharps.any?
                        (sharps.length == 1) ? "1 sharp" : "#{sharps.length} sharps"
                      elsif flats.any?
                        (flats.length == 1) ? "1 flat" : "#{flats.length} flats"
                  Severity: Minor
                  Found in lib/head_music/key_signature.rb - 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

                  Method marks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def marks
                      return if last_melodic_interval.nil?
                  
                      fitness = 1
                      fitness *= HeadMusic::PENALTY_FACTOR unless step?
                  Severity: Minor
                  Found in lib/head_music/style/guidelines/step_up_to_final_note.rb - About 25 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

                  Method from_number has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.from_number(identifier)
                      return nil unless identifier.to_s == identifier.to_i.to_s
                      return nil unless (-2..12).cover?(identifier.to_i)
                  
                      @registers ||= {}
                  Severity: Minor
                  Found in lib/head_music/register.rb - About 25 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

                  Method steps_to has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def steps_to(other, direction = :ascending)
                      other = HeadMusic::LetterName.get(other)
                      other_position = other.position
                      if direction == :descending
                        other_position -= NAMES.length if other_position > position
                  Severity: Minor
                  Found in lib/head_music/letter_name.rb - About 25 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

                  Method marks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def marks
                      return if last_melodic_interval.nil?
                  
                      fitness = 1
                      fitness *= HeadMusic::PENALTY_FACTOR unless step?
                  Severity: Minor
                  Found in lib/head_music/style/guidelines/step_down_to_final_note.rb - About 25 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

                  Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def initialize(interval:, starting_pitch: "C4")
                      @interval = interval if interval.is_a?(HeadMusic::DiatonicInterval)
                      @interval ||= interval if interval.is_a?(HeadMusic::ChromaticInterval)
                      @interval ||= HeadMusic::ChromaticInterval.get(interval) if interval.to_s.match?(/\d/)
                      @interval ||= HeadMusic::DiatonicInterval.get(interval)
                  Severity: Minor
                  Found in lib/head_music/interval_cycle.rb - About 25 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

                  Method fetch_or_create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.fetch_or_create(spelling, register = nil)
                      register ||= HeadMusic::Register::DEFAULT
                      return unless spelling && (-1..9).cover?(register)
                  
                      @pitches ||= {}
                  Severity: Minor
                  Found in lib/head_music/pitch.rb - About 25 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

                  Method unrecovered_leap? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def unrecovered_leap?(first_interval, second_interval, third_interval)
                      return false unless first_interval.large_leap?
                      return false if spelling_consonant_triad?(first_interval, second_interval, third_interval)
                      return false if second_interval.step?
                      return false if second_interval.repetition?
                  Severity: Minor
                  Found in lib/head_music/style/guidelines/single_large_leaps.rb - About 25 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