Showing 271 of 328 total issues
Avoid deeply nested control flow statements. Open
if io_buffer.length > IO_BUFFER_LEN_MAX
fast_write_str socket, io_buffer.read_and_reset
end
Avoid deeply nested control flow statements. Open
next if part.bytesize.zero?
Avoid deeply nested control flow statements. Open
if empty_body
io_buffer << CLOSE_CHUNKED
fast_write_str socket, io_buffer.read_and_reset
else
fast_write_str socket, CLOSE_CHUNKED
Method create_activated_fds
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_activated_fds(env_hash)
@log_writer.debug "ENV['LISTEN_FDS'] #{ENV['LISTEN_FDS'].inspect} env_hash['LISTEN_PID'] #{env_hash['LISTEN_PID'].inspect}"
return [] unless env_hash['LISTEN_FDS'] && env_hash['LISTEN_PID'].to_i == $$
env_hash['LISTEN_FDS'].to_i.times do |index|
sock = TCPServer.for_fd(socket_activation_fd(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
Avoid deeply nested control flow statements. Open
if u = params['umask']
# Use Integer() to respect the 0 prefix as octal
umask = Integer(u)
end
Method prepare_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_response(status, headers, res_body, requests, client)
Method thread_run_pid
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def thread_run_pid(replies, delay, sleep_time, mutex, refused, unix: false)
Method fast_write_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def fast_write_response(socket, body, io_buffer, chunked, content_length)
Method add_ssl_listener
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_ssl_listener(host, port, ctx,
optimize_for_latency=true, backlog=1024)
Method add_ssl_listener
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_ssl_listener(host, port, ctx, optimize_for_latency = true,
backlog = 1024)
Method assert_file_contents
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assert_file_contents(path, include = FILE_STR)
retries = 0
retries_max = 50 # 5 seconds
File.open(path) do |file|
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 teardown
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def teardown
@server.stop(true)
# Errno::EBADF raised on macOS
@ios.each do |io|
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 add
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add(client)
if client.env['REQUEST_PATH'] == '/s2'
Thread.pass until @pool.instance_variable_get(:@shutdown)
end
super
- 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 assert_ssl_client_error_match
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assert_ssl_client_error_match(error, subject: nil, context: CTX, &blk)
port = 0
app = lambda { |env| [200, {}, [env['rack.url_scheme']]] }
- 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 send_http_array
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_http_array(req = GET_11, len, dly: 0.000_1, max_retries: 5)
Array.new(len) {
retries = 0
begin
skt = send_http req
- 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 timeout_workers
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def timeout_workers
@workers.each do |w|
if !w.term? && w.ping_timeout <= Time.now
details = if w.booted?
"(Worker #{w.index} failed to check in within #{@options[:worker_timeout]} seconds)"
- 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_tls_v1_3
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def test_tls_v1_3
skip("TLSv1.3 protocol can not be set") unless OpenSSL::SSL::SSLContext.instance_methods(false).include?(:min_version=)
start_server
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(argv, log_writer = LogWriter.stdio, events = Events.new)
@debug = false
@argv = argv.dup
@log_writer = log_writer
@events = events
- 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 load_rackup
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def load_rackup
raise "Missing rackup file '#{rackup}'" unless File.exist?(rackup)
rack_app, rack_options = rack_builder.parse_file(rackup)
rack_options = rack_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 wakeup!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def wakeup!
return unless @wakeup
@wakeup.write Puma::Const::PipeRequest::WAKEUP unless @wakeup.closed?
- 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"