jpmckinney/copy_paste_pdf

View on GitHub

Showing 2 of 2 total issues

Method copy_into_cell_below has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def copy_into_cell_below(*indices)
      source = nil
      each do |row|
        if !block_given? || !yield(row)
          values = row.values_at(*indices)
Severity: Minor
Found in lib/copy_paste_pdf/table.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 merge_into_cell_above has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_into_cell_above(*indices)
      each_with_index.reverse_each do |row,i|
        if row.each_with_index.all?{|value,j| value.nil? || indices.include?(j)}
          indices.each do |index|
            if self[i - 1][index]
Severity: Minor
Found in lib/copy_paste_pdf/table.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

Severity
Category
Status
Source
Language