Showing 15 of 15 total issues
Method run
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def run
loop do
if defined?(JRuby) || defined?(Rubinius) || @mode == :prefork || @mode == :threaded
data, sender = @socket.recvfrom(1152)
port, _, host = sender[1..3]
- 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 respond
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def respond(exchange, env = nil)
block_enabled = @options[:Block] && exchange.get?
if block_enabled
# Fail if m set.
- 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 Exchange
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class Exchange < Struct.new(:host, :port, :message, :ancillary, :options)
include Registry
def accept
message.options[:accept]
Method _call
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _call(env)
if env['REQUEST_METHOD'] != 'GET'
return [405, {}, ['']]
end
Method respond
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
def respond(exchange, env = nil)
block_enabled = @options[:Block] && exchange.get?
if block_enabled
# Fail if m set.
Method run
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run
loop do
if defined?(JRuby) || defined?(Rubinius) || @mode == :prefork || @mode == :threaded
data, sender = @socket.recvfrom(1152)
port, _, host = sender[1..3]
Method register
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def register(controller, options)
name = controller.controller_name
default = options.delete(:default)
routes_hash.each do |link, route|
- 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 basic_env
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def basic_env(exchange)
m = exchange.message
{
REMOTE_ADDR => exchange.host,
Method dispatch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def dispatch(*args)
data, sender, _, anc = args
if jruby_or_rbx?
port, _, host = sender[1..3]
- 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 default
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.default(options = {})
# Guess.
if ENV.include?("PHP_FCGI_CHILDREN")
Rack::Handler::FastCGI
elsif ENV.include?(REQUEST_METHOD)
- 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 7 (exceeds 5 allowed). Consider refactoring. Open
def run
loop do
if jruby_or_rbx?
dispatch(*@socket.recvfrom(1152))
else
- 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_host
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def normalize_host(host)
ip = IPAddr.new(host)
if ipv6? && ip.ipv4?
ip = ip.ipv4_mapped
- 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 multicast_initialize!
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def multicast_initialize!
@socket.to_io.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, 1)
if ipv6?
maddrs = @options[:MulticastGroups]
- 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 too many return
statements within this method. Open
return error(exchange, 4.06) if exchange.accept && exchange.accept != cf
Method multicast?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def multicast?
a = ancillary
return false if a.nil?
return @multicast unless @multicast.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"