Showing 4 of 8 total issues
Method add_default_values
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def add_default_values(params)
return {} if params.nil? || params.empty?
{}.tap do |result|
params.each_pair do |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 request_loop
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def request_loop(total, result, offset, requested_limit, max_limit_per_call = 100)
Method handle_result
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle_result(result, content_type)
if not result.body.to_s.empty?
if content_type == 'text'
result.body
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 request_loop
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def request_loop(total, result, offset, requested_limit, max_limit_per_call = 100)
offset ||= 0
if (requested_limit.nil? || requested_limit.to_i > max_limit_per_call) && total > max_limit_per_call
- 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"