Showing 9 of 11 total issues
Method respond
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def respond(response, headers_or_body = {}, body = nil)
raise StateError, "not in header state" if @response_state != :headers
if headers_or_body.is_a? Hash
headers = headers_or_body
- 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 read
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def read(length = nil, buffer = nil)
raise ArgumentError, "negative length #{length} given" if length && length < 0
return '' if length == 0
res = buffer.nil? ? '' : buffer.clear
- 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 readpartial
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def readpartial(length = nil)
if length.nil? && @buffer.length > 0
slice = @buffer
@buffer = ""
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 handle_request
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def handle_request(request)
query = {}
(request.query_string || '').split('&').each do |kv|
key, value = kv.split('=')
if key && value
- 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 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def respond(response, headers_or_body = {}, body = nil)
raise StateError, "not in header state" if @response_state != :headers
if headers_or_body.is_a? Hash
headers = headers_or_body
Method handle_request
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_request(request)
query = {}
(request.query_string || '').split('&').each do |kv|
key, value = kv.split('=')
if key && value
Method handle_connection
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def handle_connection(socket)
if @spy
require 'reel/spy'
socket = Reel::Spy.new(socket, @spy)
end
- 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 request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def request
raise StateError, "already processing a request" if current_request
req = @parser.current_request
@request_fsm.transition :headers
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def initialize(status, body_or_headers = nil, body = nil)
self.status = status
if body_or_headers.is_a?(Hash)
headers = body_or_headers.dup
- 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"