Showing 5 of 5 total issues
Method oauth
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def oauth(consumer_key=nil, access_token=nil, token_secret=nil, consumer_secret=nil)
if !consumer_key.nil?
@oauth = true
options = {:consumer_key => consumer_key}
options[:token] = access_token unless access_token.nil? || access_token.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
Method query_params_from_hash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def query_params_from_hash(value, prefix = nil)
case value
when Array
value.map { |v| query_params_from_hash(v, "#{prefix}%5B%5D") }.join("&")
when Hash
- 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_body_to_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request_body_to_hash(qs, d = nil)
params = Rack::Utils::KeySpaceConstrainedParams.new
default_sep = /[&;] */n
(qs || '').split(d ? /[#{d}] */n : default_sep).each do |p|
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def parse
raise "The response does not contain a body" if body.nil? || body.empty?
if block_given?
yield body, content_type
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 pass_values_onto_requestable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def pass_values_onto_requestable(requestable)
requestable.headers self.headers unless self.headers.nil? || self.headers.empty?
requestable.adapter self.adapter unless @connection.nil?
if has_middleware?
@middlewares.each {|middleware| requestable.use *middleware }
- 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"