Showing 9 of 9 total issues
File cheetah.rb
has 324 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "abstract_method"
require "logger"
require "shellwords"
require "stringio"
Method select_loop
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def select_loop(streams, pipes, recorder)
# We write the command's input and read its output using a select loop.
# Why? Because otherwise we could end up with a deadlock.
#
# Imagine if we first read the whole standard output and then the whole
- 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 select_loop
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_loop(streams, pipes, recorder)
# We write the command's input and read its output using a select loop.
# Why? Because otherwise we could end up with a deadlock.
#
# Imagine if we first read the whole standard output and then the whole
Method fork_commands_recursive
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def fork_commands_recursive(commands, pipes, options)
fork do
# support chrooting
options = chroot_step(options)
- 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 report_errors
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def report_errors(commands, status, streams, streamed)
return if status.success?
stderr_part = if streamed[:stderr]
" (error output streamed away)"
- 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 fork_commands_recursive
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fork_commands_recursive(commands, pipes, options)
fork do
# support chrooting
options = chroot_step(options)
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(commands, status, stdout, stderr, message = nil)
Method run
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
options = BUILTIN_DEFAULT_OPTIONS.merge(@default_options).merge(options)
options[:stdin] ||= "" # allow passing nil stdin see issue gh#11
- 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 build_streams
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def build_streams(options, streamed)
{
stdin: streamed[:stdin] ? options[:stdin] : StringIO.new(options[:stdin]),
stdout: streamed[:stdout] ? options[:stdout] : StringIO.new(+""),
stderr: streamed[:stderr] ? options[:stderr] : StringIO.new(+"")
- 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"