LRDesign/Caliph

View on GitHub

Showing 7 of 7 total issues

Method wait has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    def wait
      @accumulators = {}
      waits = {}
      @buffered_echo = []

Severity: Minor
Found in lib/caliph/command-run-result.rb - About 3 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

Class CommandLine has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

  class CommandLine
    include DefineOp

    class << self
      attr_accessor :output_stream
Severity: Minor
Found in lib/caliph/command-line.rb - About 2 hrs to fix

    Method wait has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def wait
          @accumulators = {}
          waits = {}
          @buffered_echo = []
    
    
    Severity: Minor
    Found in lib/caliph/command-run-result.rb - About 1 hr to fix

      Method consume_buffers has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def consume_buffers(readable)
            if not(readable.nil? or readable.empty?)
              readable.each do |io|
                begin
                  while chunk = io.read_nonblock(4096)
      Severity: Minor
      Found in lib/caliph/command-run-result.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 define_chain_op has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def define_chain_op(opname, klass)
              define_method(opname) do |other|
                unless CommandLine === other
                  other = CommandLine.new(*[*other])
                end
      Severity: Minor
      Found in lib/caliph/define-op.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 normalize_command_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def normalize_command_line(*args, &block)
            command_line = nil
            if args.empty? or args.first == nil
              command_line = CommandLine.new
            elsif args.all?{|arg| arg.is_a? String}
      Severity: Minor
      Found in lib/caliph/shell.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 format_streams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def format_streams
            "stdout:#{stdout.nil? || stdout.empty? ? "[empty]\n" : "\n#{stdout}"}" +
            "stderr:#{stderr.nil? || stderr.empty? ? "[empty]\n" : "\n#{stderr}"}---"
          end
      Severity: Minor
      Found in lib/caliph/command-run-result.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