wbailey/command_line_reporter

View on GitHub

Showing 3 of 3 total issues

Method output has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def output
      screen_count.times do |sr|
        border_char = use_utf8? ? "\u2503" : '|'

        line = border ? "#{border_char} " : ''
Severity: Minor
Found in lib/command_line_reporter/row.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 reformat_wrapped has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def reformat_wrapped(text)
      lines = []
      text.lines.each do |line|
        line_words = (wrap == 'word') ? line.split(/\s+/) : [line]
        line_words.each do |word|
Severity: Minor
Found in lib/command_line_reporter/column.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 output has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def output
      return if rows.empty? # we got here with nothing to print to the screen
      auto_adjust_widths if width == :auto

      puts separator('first') if border
Severity: Minor
Found in lib/command_line_reporter/table.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

Severity
Category
Status
Source
Language