Showing 328 of 328 total issues
Class Launcher
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Launcher
autoload :BundlePruner, 'puma/launcher/bundle_pruner'
# Returns an instance of Launcher
#
Method send_request
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def send_request
uri = URI.parse @control_url
host = uri.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"
Further reading
Class Cluster
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class Cluster < Runner
def initialize(launcher)
super(launcher)
@phase = 0
Method run
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
title = "puma: cluster worker #{index}: #{master}"
title += " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty?
$0 = title
File launcher.rb
has 331 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'log_writer'
require_relative 'events'
require_relative 'detect'
require_relative 'cluster'
require_relative 'single'
Method run
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
def run
time_start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
super
# default values
@duration ||= 10
- 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 normalize_env
has a Cognitive Complexity of 27 (exceeds 5 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]
- 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 spawn_thread
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def spawn_thread
@spawned += 1
trigger_before_thread_start_hooks
th = Thread.new(@spawned) do |spawned|
- 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 decode_chunk
has 92 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_chunk(chunk)
if @partial_part_left > 0
if @partial_part_left <= chunk.size
if @partial_part_left > 2
write_chunk(chunk[0..(@partial_part_left-3)]) # skip the \r\n
Method wait_workers
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def wait_workers
# Reap all children, known workers or otherwise.
# If puma has PID 1, as it's common in containerized environments,
# then it's responsible for reaping orphaned processes, so we must reap
# all our dead children, regardless of whether they are workers we spawned
- 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 minissl.rb
has 311 lines of code (exceeds 250 allowed). Consider refactoring. Open
begin
require 'io/wait' unless Puma::HAS_NATIVE_IO_WAIT
rescue LoadError
end
Class Client
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Client # :nodoc:
# this tests all values but the last, which must be chunked
ALLOWED_TRANSFER_ENCODING = %w[compress deflate gzip].freeze
Method handle_servers
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_servers
begin
check = @check
sockets = [check] + @binder.ios
pool = @thread_pool
Method prepare_response
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def prepare_response(status, headers, res_body, requests, client)
env = client.env
socket = client.io
io_buffer = client.io_buffer
Method initialize
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(argv, stdout=STDOUT, stderr=STDERR)
@state = nil
@quiet = false
@pidfile = nil
@pid = nil
Method initialize
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def initialize(argv, stdout=STDOUT, stderr=STDERR)
@state = nil
@quiet = false
@pidfile = nil
@pid = 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
File test_cli.rb
has 293 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_relative "helpers/test_puma/puma_socket"
Method setup_body
has 74 lines of code (exceeds 25 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
Method fast_write_response
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def fast_write_response(socket, body, io_buffer, chunked, content_length)
if body.is_a?(::File) && body.respond_to?(:read)
if chunked # would this ever happen?
while chunk = body.read(BODY_LEN_MAX)
io_buffer.append chunk.bytesize.to_s(16), LINE_END, chunk, LINE_END
Method parse!
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse!(args)
options = {}
opt_parser = OptionParser.new("", 24, ' ') do |opts|
opts.banner = "Usage: rackup [ruby options] [rack options] [rackup config]"