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
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
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 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 initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(return_method, callbacks, thread, logger, gazelles)
Method write_response
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def write_response(request, status, headers, body)
keep_alive = request.keep_alive
if headers['Content-Length']
headers['Content-Length'] = headers['Content-Length'].to_s
- 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_next
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_next
@processing = @requests.shift
if @processing
request = @processing
- 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"