Showing 222 of 222 total issues
File test_config.rb
has 354 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "helper"
require_relative "helpers/config_file"
require "puma/configuration"
require 'puma/events'
Method handle_servers
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def handle_servers
begin
check = @check
sockets = [check] + @binder.ios
pool = @thread_pool
- 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 handle_request
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_request(client, lines)
env = client.env
io = client.io
return false if closed_socket?(io)
File test_binder.rb
has 342 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 hot_restart_does_not_drop_connections
has 105 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_on :jruby, suffix: <<-MSG
- file descriptors are not preserved on exec on JRuby; connection reset errors are expected during restarts
MSG
Method setup_options
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setup_options
@conf = Configuration.new 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
Class TestConfigFile
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
class TestConfigFile < TestConfigFileBase
parallelize_me!
def test_default_max_threads
max_threads = 16
File test_cli.rb
has 332 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/cli"
Method run
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
@status = :run
output_header "cluster"
Method spawn_thread
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def spawn_thread
@spawned += 1
th = Thread.new(@spawned) do |spawned|
Puma.set_thread_name 'threadpool %03i' % 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 parse
has 93 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(binds, logger, log_msg = 'Listening')
binds.each do |str|
uri = URI.parse str
case uri.scheme
when "tcp"
File binder.rb
has 321 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri'
require 'socket'
require 'puma/const'
require 'puma/util'
Class Server
has 30 methods (exceeds 20 allowed). Consider refactoring. Open
class Server
include Puma::Const
include Request
extend Forwardable
Method run
has 90 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
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
Method graceful_shutdown
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def graceful_shutdown
if @options[:shutdown_debug]
threads = Thread.list
total = threads.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 send_request
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def send_request
uri = URI.parse @control_url
# create server object by scheme
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 skip_on
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def skip_on(*engs, suffix: '', bt: caller)
engs.each do |eng|
skip_msg = case eng
when :darwin then "Skipped on darwin#{suffix}" if RUBY_PLATFORM[/darwin/]
when :jruby then "Skipped on JRuby#{suffix}" if Puma.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 initialize
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(argv, stdout=STDOUT, stderr=STDERR)
@state = nil
@quiet = false
@pidfile = nil
@pid = nil
File dsl.rb
has 294 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'puma/const'
module Puma
# The methods that are available for use inside the configuration file.
# These same methods are used in Puma cli and the rack handler