masukomi/differ

View on GitHub

Showing 4 of 6 total issues

Method same has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def same(*str)
      return if str.empty?
      # the items in the @raw array are strings and/or
      # changes. If the last one is a string (not a change),
      # and the item we've just encountered is another
Severity: Minor
Found in lib/differ/diff.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 advance has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def advance(source, target)
      # items moving from source -> target

      # shift the first thing off
      first_source_item, first_target_item = source.shift, target.shift
Severity: Minor
Found in lib/differ.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 call has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def call(change)
          (change.change? && as_change(change)) ||
          (change.delete? && as_delete(change)) ||
          (change.insert? && as_insert(change)) ||
          ''
Severity: Minor
Found in lib/differ/format/ascii.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 delete_or_insert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def delete_or_insert(del_or_insert, str)
      # del_or_insert accepts :delete or :insert
      return if str.empty?

      if (@raw.last.is_a? Change)
Severity: Minor
Found in lib/differ/diff.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