my-codeworks/diffident

View on GitHub

Showing 4 of 7 total issues

Method advance has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def advance
      del, add = @base.shift, @this.shift

      prioritize_insert = @this.length > @base.length
      insert = @this.index(del)
Severity: Minor
Found in lib/diffident/tokenizer.rb - About 2 hrs 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 next has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def next
      lexem_with_delimiter = string_scanner.scan_until(delimiter)
      if lexem_with_delimiter.nil?
        replenish_string_scanner_from_input
        if input_has_raised and string_scanner.eos?
Severity: Minor
Found in lib/diffident/lexer.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 run has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      advance until @base.empty? || @this.empty?
      @diff.insert(*@this) unless @this.empty?
      @diff.delete(*@base) unless @base.empty?
      return @diff
Severity: Minor
Found in lib/diffident/tokenizer.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 same has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def same( *lexems )
      if last_change.is_a? String
        last_change << change_text_from( '', *lexems )
      elsif last_change.is_a? Change
        if last_change.change?
Severity: Minor
Found in lib/diffident/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