Method parse
has a Cognitive Complexity of 93 (exceeds 5 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
- 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 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
File binder.rb
has 363 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'uri'
require 'socket'
require_relative 'const'
require_relative 'util'
Class Binder
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Binder
include Puma::Const
RACK_VERSION = [1,6].freeze
Method close_listeners
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def close_listeners
@listeners.each do |l, io|
begin
io.close unless io.closed?
uri = URI.parse l
- 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_unix_listener
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
# Let anyone connect by default
umask ||= 0
begin
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['backlog']
backlog = Integer(u)
end
Method synthesize_binds_from_activated_fs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def synthesize_binds_from_activated_fs(binds, only_matching)
return binds unless activated_sockets.any?
activated_binds = []
- 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
Avoid deeply nested control flow statements. Open
if u = params['mode']
mode = Integer('0'+u)
end
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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def add_ssl_listener(host, port, ctx,
optimize_for_latency=true, backlog=1024)
raise "Puma compiled without SSL support" unless HAS_SSL
# Puma will try to use local authority context if context is supplied 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 add_unix_listener
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_unix_listener(path, umask=nil, mode=nil, backlog=1024)
# Let anyone connect by default
umask ||= 0
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"