Showing 17 of 17 total issues
Class ScriptRunner
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
class ScriptRunner < Proxy::Dynflow::Runner::Base
include Proxy::Dynflow::Runner::ProcessManagerCommand
include CommandLogging
attr_reader :execution_timeout_interval
File script_runner.rb
has 322 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'fileutils'
require 'smart_proxy_dynflow/runner/process_manager_command'
require 'smart_proxy_dynflow/process_manager'
require 'smart_proxy_remote_execution_ssh/multiplexed_ssh_connection'
Method inner_system_ssh_loop
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def inner_system_ssh_loop(out_buf, err_buf, in_buf, pid)
err_buf_raw = ''
loop do
readers = [buf_socket, out_buf, err_buf].reject { |io| io.closed? }
writers = [buf_socket, in_buf].select { |io| io.pending_writes? }
- 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 run
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run(event = nil)
if event == JobDelivered
output[:state] = DELIVERED
suspend
elsif event == PickupTimeout
- 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 validate_ssh_settings!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_ssh_settings!
return unless requires_configured_ssh?
unless private_key_file
raise "settings for `ssh_identity_key` not set"
end
- 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 process_retrieved_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_retrieved_data(output, err)
return if output.nil? || output.empty?
lines = output.lines
result = lines.shift.match(/^DONE (\d+)?/)
- 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 set_pm_debug_logging
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_pm_debug_logging(pm, capture: false, user_method: nil)
callback = proc do |data|
data.each_line do |line|
logger.debug(line.chomp) if user_method.nil? || !user_method.filter_password?(line)
user_method.on_data(data, pm.stdin) if user_method
- 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 wait_for_pending_sends
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def wait_for_pending_sends
send_pending
while pending_writes?
result = IO.select(nil, [self]) || next
next unless result[1].any?
- 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 validate_mqtt_settings!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_mqtt_settings!
return unless Plugin.settings.mode == :'pull-mqtt'
raise 'mqtt_broker has to be set when pull-mqtt mode is used' if Plugin.settings.mqtt_broker.nil?
raise 'mqtt_port has to be set when pull-mqtt mode is used' if Plugin.settings.mqtt_port.nil?
- 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 kill_run
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def kill_run(fail_msg = 'The job was cancelled by the user')
continuous_output = Proxy::Dynflow::ContinuousOutput.new
exit_code = nil
case output[:state]
- 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 run_sync
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_sync(command, stdin: nil, close_stdin: true, tty: false, user_method: nil)
cmd = @connection.command([tty_flag(tty), command].flatten.compact)
log_command(cmd)
pm = Proxy::Dynflow::ProcessManager.new(cmd)
set_pm_debug_logging(pm, user_method: user_method)
- 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 close
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def close
run_sync("rm -rf #{remote_command_dir}") if should_cleanup?
rescue StandardError => e
publish_exception('Error when removing remote working dir', e, false)
ensure
- 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 prune_known_hosts!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def prune_known_hosts!(hostname, port, logger = Logger.new($stdout))
return if Net::SSH::KnownHosts.search_for(hostname).empty?
target = if port == 22
hostname
- 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 hijack!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def hijack!
@socket = nil
if @env['ext.hijack!']
@socket = @env['ext.hijack!'].call
elsif @env['rack.hijack?']
- 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 with_error_handling
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def with_error_handling
yield
rescue SystemCallError => e
send_error(400, e.message)
rescue SocketError => e
- 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 recv
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def recv(count)
res = ""
begin
# To drain a SSLSocket before we can go back to the event
# loop, we need to repeatedly call read_nonblock; a single
- 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
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.build(options, suspended_action:)
effective_user = options.fetch(:effective_user, nil)
ssh_user = options.fetch(:ssh_user, 'root')
effective_user_method = options.fetch(:effective_user_method, '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"