Showing 328 of 328 total issues
Method run
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
super
# default values
@duration ||= 10
Method send_request
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_request
uri = URI.parse @control_url
# create server object by scheme
server =
Method term_closes_listeners
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def term_closes_listeners(unix: false)
skip_unless_signal_exist? :TERM
cli_server "-w #{workers} -t 0:6 -q test/rackup/sleep_step.ru", unix: unix
threads = []
Method server_gets
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def server_gets(match_obj, time_timeout, log: false)
error_retries = 0
line = ''
sleep 0.05 unless @server.is_a?(IO) or Process.clock_gettime(Process::CLOCK_MONOTONIC) > time_timeout
- 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 new_socket
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def new_socket(host: nil, port: nil, path: nil, ctx: nil, session: nil)
port ||= @bind_port
path ||= @bind_path
ip ||= (host || HOST.ip).gsub RE_HOST_TO_IP, '' # in case a URI style IPv6 is passed
- 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 parse_query
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def parse_query(qs, d = nil, &unescaper)
unescaper ||= method(:unescape)
params = {}
- 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 redirect_io
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def redirect_io
stdout = @options[:redirect_stdout]
stderr = @options[:redirect_stderr]
append = @options[:redirect_append]
- 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 shutdown_requests
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def shutdown_requests(s1_complete: true, s1_response: nil, post: false, s2_response: nil, **options)
mutex = Mutex.new
app_finished = ConditionVariable.new
server_run(**options) { |env|
path = env['REQUEST_PATH']
Method ci_test_rps
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ci_test_rps
host = ENV['HOST']
port = ENV['PORT'].to_i
str = 'a' * 65_500
Method setup_options
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_options
OptionParser.new do |o|
o.on "-T", "--stream-threads THREADS", OptionParser::DecimalInteger, "request_stream: loops/threads" do |arg|
@stream_threads = arg.to_i
end
Method read_response
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def read_response(connection, timeout = nil)
timeout ||= RESP_READ_TIMEOUT
content_length = nil
chunked = nil
response = +''
Method spawn_thread
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def spawn_thread
@spawned += 1
trigger_before_thread_start_hooks
th = Thread.new(@spawned) do |spawned|
Method normalize_env
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def normalize_env(env, client)
if host = env[HTTP_HOST]
# host can be a hostname, ipv4 or bracketed ipv6. Followed by an optional port.
if colon = host.rindex("]:") # IPV6 with port
env[SERVER_NAME] = host[0, colon+1]
Method initialize
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(conf, launcher_args={})
@runner = nil
@log_writer = launcher_args[:log_writer] || LogWriter::DEFAULT
@events = launcher_args[:events] || Events.new
@argv = launcher_args[:argv] || []
Method start
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def start(launcher)
hostname = ENV['DYNO']
return unless 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 run_summaries
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def run_summaries(summaries)
digits = [4 - Math.log10(@max_100_time).to_i, 3].min
fmt_vals = +'%-6s %6d'
fmt_vals << (digits < 0 ? " %6d" : " %6.#{digits}f")*5
- 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 test_thread_name_linux
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def test_thread_name_linux
skip 'Thread.name not supported' unless Thread.current.respond_to?(:name)
task_dir = File.join('', 'proc', Process.pid.to_s, 'task')
skip 'This test only works under Linux and MRI Ruby with appropriate permissions' if !(File.directory?(task_dir) && File.readable?(task_dir) && Puma::IS_MRI)
- 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 reset
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def reset(fast_check=true)
@parser.reset
@io_buffer.reset
@read_header = true
@read_proxy = !!@expect_proxy_proto
- 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 read_nonblock
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def read_nonblock(size, *_)
# *_ is to deal with keyword args that were added
# at some point (and being used in the wild)
while true
output = engine_read_all
- 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_host_port_to_config
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def set_host_port_to_config(host, port, config)
config.clear_binds! if host || port
if host && (host[0,1] == '.' || host[0,1] == '/')
config.bind "unix://#{host}"
- 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"