ianheggie/cruisecontrol.rb

View on GitHub
lib/command_line.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method verify_exit_code has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def verify_exit_code(exit_status, cmd, full_cmd, options)
    if exit_status.exitstatus != options[:exitstatus]
      if options[:stderr]
        if File.exist?(options[:stderr])
          File.open(options[:stderr]) do |errio|
Severity: Minor
Found in lib/command_line.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 e has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def e(cmd, options, &proc)
    full_cmd = full_cmd(cmd, options, &proc)
    
    options[:env].each{|k,v| ENV[k]=v}
    begin
Severity: Minor
Found in lib/command_line.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 full_cmd has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

  def full_cmd(cmd, options, &proc)
    stdout_opt, stderr_opt = redirects(options)

    capture_info_command = (block_given? && options[:stdout]) ?
        "echo '[output captured and therefore not logged]' >> #{options[:stdout]} && " :
Severity: Minor
Found in lib/command_line.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 e has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def e(cmd, options, &proc)
    full_cmd = full_cmd(cmd, options, &proc)
    
    options[:env].each{|k,v| ENV[k]=v}
    begin
Severity: Minor
Found in lib/command_line.rb - About 1 hr to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(cmd, full_cmd, dir, exitstatus, stderr)
    Severity: Minor
    Found in lib/command_line.rb - About 35 mins to fix

      There are no issues that match your filters.

      Category
      Status