Showing 28 of 28 total issues
Method send_next_response
has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring. Open
def send_next_response
request, result = @responses.shift
@transmitting = request
return unless request
- 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 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.parse(args)
options = {}
parser = OptionParser.new do |opts|
# ================
File http1.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'http-parser' # C based, fast, http parser
require 'spider-gazelle/gazelle/request'
module SpiderGazelle
Method send_next_response
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
def send_next_response
request, result = @responses.shift
@transmitting = request
return unless request
Method execute!
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def execute!
@env['CONTENT_LENGTH'] = @env.delete('HTTP_CONTENT_LENGTH') || @body.bytesize.to_s
@env['CONTENT_TYPE'] = @env.delete('HTTP_CONTENT_TYPE') || 'text/plain'
@env['REQUEST_URI'] = @url.freeze
- 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 Http1
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Http1
class Callbacks
def initialize
@parser = ::HttpParser::Parser.new self
@logger = Logger.instance
Method execute!
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def execute!
@env['CONTENT_LENGTH'] = @env.delete('HTTP_CONTENT_LENGTH') || @body.bytesize.to_s
@env['CONTENT_TYPE'] = @env.delete('HTTP_CONTENT_TYPE') || 'text/plain'
@env['REQUEST_URI'] = @url.freeze
Method parse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.parse(args)
options = {}
parser = OptionParser.new do |opts|
# ================
- 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 process_on_gazelle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def process_on_gazelle(request)
result = begin
request.execute!
rescue StandardError => e
Logger.instance.print_error e, 'framework error'
- 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 load_gazelles
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_gazelles(mode, count, options)
defer = @thread.defer
@loading[mode] = defer
if mode == :inline
Method become_sg_master
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def become_sg_master
@is_master = true
@is_client = false
@is_connected = true
Method connect_to_sg_master
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def connect_to_sg_master
@pipe = @thread.pipe :ipc
@pipe.connect(SIGNAL_SERVER) do |client|
@is_client = true
@is_connected = true
Method initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(tcp, env)
@socket, @env = tcp, env
# Initialise the promise
super tcp.reactor, tcp.reactor.defer
Method become_sg_master
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def become_sg_master
@is_master = true
@is_client = false
@is_connected = true
- 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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def initialize(tcp, env)
@socket, @env = tcp, env
# Initialise the promise
super tcp.reactor, tcp.reactor.defer
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(thread, app, port, remote_ip, scheme, socket)
Method load
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.load(rackup, options)
begin
@critical.synchronize {
return if @loaded[rackup]
- 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 sanitize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.sanitize(args)
# Use "\0" as this character won't be used in the command
cmdline = args.join("\0")
components = cmdline.split("\0--", -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 process_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def process_request(data, client)
validated = @validated.include?(client)
parser = @validating[client.object_id]
if validated
- 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 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(return_method, callbacks, thread, logger, gazelles)