pedrozath/coltrane

View on GitHub

Showing 26 of 29 total issues

Method replace_x has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def replace_x(line, notes, size, index = 0)
          line.gsub('X' * size).with_index do |_match, i|
            note = notes[i % notes.size]
            next ' ' * size unless note_set.include?(note)
            Paint[replacer(note)[size == 2 ? 0..2 : index], 'red']

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 7 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(notes: nil, root_note: nil, quality: nil, name: nil)
        if notes
          notes      = NoteSet[*notes] if notes.is_a?(Array)
          @notes     = notes
          @root_note = notes.first
Severity: Minor
Found in lib/coltrane/theory/chord.rb - 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

Method clone_values has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def clone_values(from_keys: nil,
                   to_keys: nil,
                   suffix: nil,
                   branch_a: nil,
                   branch_b: nil)
Severity: Minor
Found in lib/core_ext.rb - 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

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

      def quality_name
        return @chord.quality.name unless @chord.nil?
        q     = normalize_quality_name(regexed_notation[:quality])
        minor = 'm' if (!q.match? /dim|m7b5/) && !upcase?
        q     = [minor, q].join
Severity: Minor
Found in lib/coltrane/theory/roman_chord.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(name: nil, notes: nil, bass: nil)
        if name
          @name = bass.nil? ? name : [name, bass].join('/')
          super(*intervals_from_name(name))
        elsif notes
Severity: Minor
Found in lib/coltrane/theory/chord_quality.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(arg)
        note_name = case arg
                    when String then arg
                    when PitchClass then arg.true_notation
                    when Numeric, Frequency then PitchClass.new(arg).true_notation
Severity: Minor
Found in lib/coltrane/theory/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

Severity
Category
Status
Source
Language