Showing 18 of 20 total issues
Method extract_stream
has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring. Open
def extract_stream(compressed)
@data << compressed
pos = @pos
while !eof? && !finished?
- 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_response_header
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def parse_response_header(header, version, status)
@response_header.raw = header
header.each do |key, val|
@response_header[key.upcase.gsub('-','_')] = val
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 unbind
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def unbind(reason = nil)
if finished?
if redirect?
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"
Further reading
Method extract_stream
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def extract_stream(compressed)
@data << compressed
pos = @pos
while !eof? && !finished?
Method parse_response_header
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_response_header(header, version, status)
@response_header.raw = header
header.each do |key, val|
@response_header[key.upcase.gsub('-','_')] = val
end
Method build_request
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def build_request
head = @req.headers ? munge_header_keys(@req.headers) : {}
if @conn.connopts.http_proxy?
proxy = @conn.connopts.proxy
- 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 build_auth_digest
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_auth_digest(method, uri, params = nil)
params = @opts.merge(@digest_params) if !params
nonce_count = next_nonce
user = unescape params[:username]
Method build_auth_digest
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def build_auth_digest(method, uri, params = nil)
params = @opts.merge(@digest_params) if !params
nonce_count = next_nonce
user = unescape params[:username]
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def request(client, head, body)
request = client.req
uri = request.uri.join(encode_query(request.uri, request.query))
params = {}
- 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 send_request
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def send_request(head, body)
body = normalize_body(body)
file = @req.file
query = @req.query
- 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(uri, options)
@connect_timeout = options[:connect_timeout] || 5 # default connection setup timeout
@inactivity_timeout = options[:inactivity_timeout] ||= 10 # default connection inactivity (post-setup) timeout
@tls = options[:tls] || options[:ssl] || {}
- 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 form_encode_body
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def form_encode_body(obj)
pairs = []
recursive = Proc.new do |h, prefix|
h.each do |k,v|
key = prefix == '' ? escape(k) : "#{prefix}[#{escape(k)}]"
- 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 buffer == 0
@state = :comment
break
end
Method set_uri
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_uri(uri, path = nil)
uri = uri.kind_of?(Addressable::URI) ? uri : Addressable::URI::parse(uri.to_s)
uri.path = path if path
uri.path = '/' if uri.path.empty?
- 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 buffer == 0
@state = :hcrc
break
end
Method unbind
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def unbind(reason = nil)
@clients.map { |c| c.unbind(reason) }
if r = @pending.shift
@clients.push r
- 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 finalize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def finalize
if @zstream
if !@zstream.finished?
r = @zstream.finish
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 encode_query
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def encode_query(uri, query)
encoded_query = if query.kind_of?(Hash)
query.map { |k, v| encode_param(k, v) }.join('&')
else
query.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"