Showing 270 of 327 total issues
Method select_loop
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def select_loop
close_selector = true
begin
until @input.closed? && @input.empty?
# Wakeup any registered object that receives incoming data.
Method add_unix_listener
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
# Let anyone connect by default
umask ||= 0
begin
Method set_remote_address
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set_remote_address(val=:socket)
case val
when :socket
@options[:remote_address] = val
when :localhost
Method curl_and_get_response
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def curl_and_get_response(url, method: :get, args: nil); require 'open3'
cmd = "curl -s -v --show-error #{args} -X #{method.to_s.upcase} -k #{url}"
begin
out, err, status = Open3.capture3(cmd)
rescue Errno::ENOENT
- 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_wrk_parse
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def run_wrk_parse(cmd, log: false)
STDOUT.syswrite cmd.ljust 55
if @dly_app
cmd.sub! ' -H ', " -H 'Dly: #{@dly_app.round 4}' -H "
- 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 serialize_value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def serialize_value(output, value)
case value
when Hash
output << '{'
value.each_with_index do |(k, v), index|
- 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 write
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def write(data)
return 0 if data.empty?
data_size = data.bytesize
need = data_size
- 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_remote_address
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_remote_address(val=:socket)
case val
when :socket
@options[:remote_address] = val
when :localhost
- 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
Avoid deeply nested control flow statements. Open
rescue EOFError
break
Method spawn_workers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def spawn_workers
diff = @options[:workers] - @workers.size
return if diff < 1
master = Process.pid
- 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 str_headers
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def str_headers(env, status, headers, res_body, io_buffer, force_keep_alive)
Method test_ssl_v3_rejection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def test_ssl_v3_rejection
skip("SSLv3 protocol is unavailable") if Puma::MiniSSL::OPENSSL_NO_SSL3
start_server
assert_raises(OpenSSL::SSL::SSLError) do
- 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
Avoid deeply nested control flow statements. Open
if !booted && @workers.none? {|worker| worker.last_status.empty?}
@events.fire_on_booted!
debug_loaded_extensions("Loaded Extensions - master:") if @log_writer.debug?
booted = true
end
Avoid deeply nested control flow statements. Open
if idle_workers[pid]
idle_workers.delete pid
else
idle_workers[pid] = true
end
Avoid deeply nested control flow statements. Open
if in_phased_restart && workers_not_booted.positive? && w0 = worker_at(0)
w0.ping!(status)
@events.fire(:ping!, w0)
end
Method test_drain_on_shutdown
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def test_drain_on_shutdown(drain=true)
num_connections = 10
wait = Queue.new
server_run(drain_on_shutdown: drain, max_threads: 1) do
- 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 thread_run_step
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def thread_run_step(replies, delay, sleep_time, step, mutex, refused, unix: false)
Avoid deeply nested control flow statements. Open
w.term unless w.term?
Method test_verify_client_cert_roundtrip
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def test_verify_client_cert_roundtrip(tls1_2 = nil)
cert_path = File.expand_path '../examples/puma/client-certs', __dir__
bind_port
config = <<~CONFIG
- 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 check_workers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_workers
return if @next_check >= Time.now
@next_check = Time.now + @options[:worker_check_interval]
- 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"