Showing 327 of 327 total issues
File cluster.rb
has 446 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'runner'
require_relative 'util'
require_relative 'plugin'
require_relative 'cluster/worker_handle'
require_relative 'cluster/worker'
Class TestBinderParallel
has 46 methods (exceeds 20 allowed). Consider refactoring. Open
class TestBinderParallel < TestBinderBase
parallelize_me!
def test_synthesize_binds_from_activated_fds_no_sockets
binds = ['tcp://0.0.0.0:3000']
Method str_headers
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def str_headers(env, status, headers, res_body, io_buffer, force_keep_alive)
line_ending = LINE_END
colon = COLON
- 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_response
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
def read_response(connection, timeout = nil)
timeout ||= RESP_READ_TIMEOUT
content_length = nil
chunked = nil
response = +''
- 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
File request.rb
has 427 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Puma
#———————————————————————— DO NOT USE — this class is for internal use only ———
# The methods here are included in Server, but are separated into this file.
File dsl.rb
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'const'
require_relative 'util'
module Puma
# The methods that are available for use inside the configuration file.
Method skip_if
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def skip_if(*engs, suffix: '', bt: caller)
engs.each do |eng|
skip_msg = case eng
when :linux then "Skipped if Linux#{suffix}" if Puma::IS_LINUX
when :darwin then "Skipped if darwin#{suffix}" if Puma::IS_OSX
- 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
File integration.rb
has 415 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "puma/control_cli"
require "json"
require "open3"
require_relative 'tmp_path'
File test_binder.rb
has 403 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "helper"
require_relative "helpers/ssl" if ::Puma::HAS_SSL
require_relative "helpers/tmp_path"
require "puma/binder"
Method prepare_response
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def prepare_response(status, headers, res_body, requests, client)
env = client.env
socket = client.io
io_buffer = client.io_buffer
- 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 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
@status = :run
output_header "cluster"
Method parse
has 123 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(binds, log_writer = nil, log_msg = 'Listening')
log_writer ||= @log_writer
binds.each do |str|
uri = URI.parse str
case uri.scheme
Method process_client
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def process_client(client)
# Advertise this server into the thread
Thread.current[THREAD_LOCAL_KEY] = self
clean_thread_locals = options[:clean_thread_locals]
- 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 skip_unless
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def skip_unless(eng, bt: caller)
skip_msg = case eng
when :linux then "Skip unless Linux" unless Puma::IS_LINUX
when :darwin then "Skip unless darwin" unless Puma::IS_OSX
when :jruby then "Skip unless JRuby" unless Puma::IS_JRUBY
- 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 setup_body
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def setup_body
@body_read_start = Process.clock_gettime(Process::CLOCK_MONOTONIC, :float_millisecond)
if @env[HTTP_EXPECT] == CONTINUE
# TODO allow a hook here to check the headers before
- 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
File binder.rb
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri'
require 'socket'
require_relative 'const'
require_relative 'util'
Method hot_restart_does_not_drop_connections
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hot_restart_does_not_drop_connections(num_threads: 1, total_requests: 500)
skipped = true
skip_if :jruby, suffix: <<-MSG
- file descriptors are not preserved on exec on JRuby; connection reset errors are expected during restarts
MSG
Method setup_options
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_options
@conf = Configuration.new({}, {events: @events}) do |user_config, file_config|
@parser = OptionParser.new do |o|
o.on "-b", "--bind URI", "URI to bind to (tcp://, unix://, ssl://)" do |arg|
user_config.bind arg
Method handle_request
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def handle_request(client, requests)
env = client.env
io_buffer = client.io_buffer
socket = client.io # io may be a MiniSSL::Socket
app_body = 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
Class Server
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Server
include Puma::Const
include Request
attr_reader :options