pedrozath/coltrane

View on GitHub

Showing 29 of 29 total issues

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

      def initialize(notation = nil, chords: nil, roman_chords: nil, key: nil, scale: nil)
        if notation.nil? && chords.nil? && roman_chords.nil? || key.nil? && scale.nil?
          raise WrongKeywordsError,
            '[chords:, [scale: || key:]] '\
            '[roman_chords:, [scale: || key:]] '\
Severity: Minor
Found in lib/coltrane/theory/progression.rb - 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

Method render has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def render
          output = []
          scale_width = scale_set.results.keys.map(&:size).max
          scale_set.results.each do |name, scales_by_tone|
            output << name.ljust(scale_width + 1, ' ')
Severity: Minor
Found in lib/coltrane/renderers/text_renderer/theory_scale_set_drawer.rb - 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

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 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 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 having_notes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

      def having_notes(notes)
        PitchClass.all
        .reduce([]) { |scales, tone|
          standard_scales
          .reduce([]) { |tone_scales, scale|
Severity: Minor
Found in lib/coltrane/theory/classic_scales.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 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

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

Severity
Category
Status
Source
Language