skylerto/litterbox

View on GitHub

Showing 4 of 4 total issues

Method capture_stderr has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def capture_stderr(err)
      while (line = err.gets)
        @stderr << line unless line.nil?
        puts(line) if @log
      end
Severity: Minor
Found in lib/litterbox/command.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 upload has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def upload(pkg = @pkg, auth = @auth)
        raise 'file artifact not found' unless File.exist?(pkg)
        raise 'must pass auth token' unless auth
        cmd = "hab pkg upload #{pkg} -z #{auth}"
        puts cmd
Severity: Minor
Found in lib/litterbox/habitat/upload.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 capture_stdout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def capture_stdout(out)
      while (lines = out.gets)
        @stdout << lines unless lines.nil?
        puts(lines) if @log
      end
Severity: Minor
Found in lib/litterbox/command.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 download_hab_plan has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def download_hab_plan
  domain = ENV['PLAN_DOMAIN'] || 'github.com'
  path = ENV['PLAN_PATH'] || '/habitat-sh/sample-node-app/archive/master.zip'
  download_path = "#{File.dirname(__FILE__)}/plan.zip"
  destination_path = "#{File.dirname(__FILE__)}/plan"
Severity: Minor
Found in spec/spec_helper.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