Showing 15 of 15 total issues
Method go
has a Cognitive Complexity of 108 (exceeds 5 allowed). Consider refactoring. Open
def go(&stream_block)
@status = :running
@results = Hash.new { |h, k| h[k] = {} }
@hosts.each do |host|
# First try identifying using lsb_release. This takes care of Ubuntu (lsb-release is part of ubuntu-minimal).
- Read upRead up
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 execute
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def execute(cmd, sudo = false, &stream_block)
results = { exit_status: nil, stdout: '', stderr: '' }
sudo = false if @username == 'root'
if sudo
- Read upRead up
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 go
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
def go(&stream_block)
@status = :running
@results = Hash.new { |h, k| h[k] = {} }
@hosts.each do |host|
# First try identifying using lsb_release. This takes care of Ubuntu (lsb-release is part of ubuntu-minimal).
Method execute
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(cmd, sudo = false, &stream_block)
results = { exit_status: nil, stdout: '', stderr: '' }
sudo = false if @username == 'root'
if sudo
Method execute
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute(steps)
# Perform the plan given
skip_remaining_steps = false
steps.each do |step|
Method ssh_connect
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ssh_connect
unless @localhost
log = StringIO.new
logger = Logger.new(log)
logger.formatter = proc { |level, date, _progname, msg|
Method execute
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def execute(steps)
# Perform the plan given
skip_remaining_steps = false
steps.each do |step|
- Read upRead up
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 go
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def go(&stream_block)
@status = :running
begin
if @content
Method initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize(hostname, config = {})
@hostname = hostname
@username = if config[:username].nil? || config[:username].strip.empty?
'root'
else
- Read upRead up
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 ssh_connect
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def ssh_connect
unless @localhost
log = StringIO.new
logger = Logger.new(log)
logger.formatter = proc { |level, date, _progname, msg|
- Read upRead up
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 go
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def go(&stream_block)
@status = :running
if @from
begin
- Read upRead up
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 go
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def go(&stream_block)
@status = :running
begin
if @content
- Read upRead up
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 sudo_stdin
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def sudo_stdin(ch, info, data, sudo_prompt, &stream_block)
Method exec_and_log
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def exec_and_log(host, cmd, sudo, results, &stream_block)
Method sudo_stdin
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sudo_stdin(ch, info, data, sudo_prompt, &stream_block)
# Sudo handling
if data == sudo_prompt
if @sudo_password
ch.send_data "#{@sudo_password}\r\n"
- Read upRead up
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"