Showing 220 of 220 total issues
File test_puma_server.rb
has 850 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "helper"
require "puma/events"
require "net/http"
require "nio"
Class TestPumaServer
has 81 methods (exceeds 20 allowed). Consider refactoring. Open
class TestPumaServer < Minitest::Test
parallelize_me! unless JRUBY_HEAD
def setup
@host = "127.0.0.1"
Method run
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
def run
@status = :run
output_header "cluster"
- 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 DSL
has 62 methods (exceeds 20 allowed). Consider refactoring. Open
class DSL
include ConfigDefault
# convenience method so logic can be used in CI
# @see ssl_bind
Method parse
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
def parse(binds, logger, log_msg = 'Listening')
binds.each do |str|
uri = URI.parse str
case uri.scheme
when "tcp"
- 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 a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def run
title = "puma: cluster worker #{index}: #{master}"
title += " [#{@options[:tag]}]" if @options[:tag] && !@options[:tag].empty?
$0 = title
- 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 a Cognitive Complexity of 44 (exceeds 5 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
- 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 hot_restart_does_not_drop_connections
has a Cognitive Complexity of 42 (exceeds 5 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
- 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 server.rb
has 422 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'stringio'
require 'puma/thread_pool'
require 'puma/const'
require 'puma/events'
Method context
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def context
ctx = MiniSSL::Context.new
if defined?(JRUBY_VERSION)
unless params['keystore']
- 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 a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def str_headers(env, status, headers, res_info, lines)
line_ending = LINE_END
colon = COLON
http_11 = env[HTTP_VERSION] == HTTP_11
- 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 TestBinder
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
class TestBinder < TestBinderBase
parallelize_me!
def test_synthesize_binds_from_activated_fds_no_sockets
binds = ['tcp://0.0.0.0:3000']
Method process_client
has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring. Open
def process_client(client, buffer)
# Advertise this server into the thread
Thread.current[ThreadLocalKey] = 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
File launcher.rb
has 379 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'puma/events'
require 'puma/detect'
require 'puma/cluster'
require 'puma/single'
require 'puma/const'
Method handle_request
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def handle_request(client, lines)
env = client.env
io = client.io
return false if closed_socket?(io)
- 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_integration_cluster.rb
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative "helper"
require_relative "helpers/integration"
class TestIntegrationCluster < TestIntegration
parallelize_me! if ::Puma.mri?
Class TestIntegrationCluster
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class TestIntegrationCluster < TestIntegration
parallelize_me! if ::Puma.mri?
def workers ; 2 ; end
File cluster.rb
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'puma/runner'
require 'puma/util'
require 'puma/plugin'
require 'puma/cluster/worker_handle'
require 'puma/cluster/worker'
Class Launcher
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class Launcher
KEYS_NOT_TO_PERSIST_IN_STATE = [
:logger, :lowlevel_error_handler,
:before_worker_shutdown, :before_worker_boot, :before_worker_fork,
:after_worker_boot, :before_fork, :on_restart
File client.rb
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
class IO
# We need to use this for a jruby work around on both 1.8 and 1.9.
# So this either creates the constant (on 1.8), or harmlessly
# reopens it (on 1.9).
module WaitReadable