Showing 3 of 3 total issues
Method request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def request(method, path, params, response_options)
response = connection(response_options[:raw]).send(method) do |request|
case method
when :get, :delete
request.url(URI.encode(path), 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 error_body
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def error_body(body)
# body gets passed as a string, not sure if it is passed as something else from other spots?
if not body.nil? and not body.empty? and body.kind_of?(String)
# removed multi_json thanks to wesnolte's commit
body = ::JSON.parse(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 create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.create( response, response_options)
return response if response_options[:raw]
return response.body if response_options[:no_response_wrapper]
if response_options[:return_object]
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"