lib/sixword/cli.rb

Summary

Maintainability
C
1 day
Test Coverage

Method accumulate_hex_input has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def accumulate_hex_input
      unless block_given?
        raise ArgumentError.new("must pass block")
      end

Severity: Minor
Found in lib/sixword/cli.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 process_encode_input has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def process_encode_input
      unless block_given?
        raise ArgumentError.new("block is required")
      end

Severity: Minor
Found in lib/sixword/cli.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 print_hex has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def print_hex(data, chunk_index, cols=80)
      case hex_style
      when 'lower', 'lowercase'
        # encode to lowercase hex with no newlines
        print Sixword::Hex.encode(data)
Severity: Minor
Found in lib/sixword/cli.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 accumulate_hex_input has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def accumulate_hex_input
      unless block_given?
        raise ArgumentError.new("must pass block")
      end

Severity: Minor
Found in lib/sixword/cli.rb - About 1 hr to fix

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

        def run!
          if encoding?
            do_encode! do |encoded|
              puts encoded
            end
    Severity: Minor
    Found in lib/sixword/cli.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 read_input_by_6_words has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def read_input_by_6_words
          word_arr = []
    
          while true
            line = stream.gets
    Severity: Minor
    Found in lib/sixword/cli.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 do_encode! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_encode!
          sentences_per_line = options.fetch(:line_width, 1)
          if sentences_per_line <= 0
            sentences_per_line = 1 << 32
          end
    Severity: Minor
    Found in lib/sixword/cli.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

    There are no issues that match your filters.

    Category
    Status