Showing 21 of 21 total issues
Method decode
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def self.decode(query)
return nil if query == nil
# Recursive helper lambda
dehash = lambda do |hash|
hash.each 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 encode
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.encode(params)
return nil if params == nil
if !params.is_a?(Array)
if !params.respond_to?(:to_hash)
Method decode
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.decode(query)
return nil if query == nil
# Recursive helper lambda
dehash = lambda do |hash|
hash.each do |(key, value)|
Method encode
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.encode(params)
return nil if params == nil
if !params.is_a?(Array)
if !params.respond_to?(:to_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 save
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def save(relative_path = nil, data = {}, options = {})
return false unless before_save
clear_induced_errors
- 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 resource_data_for_server
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def resource_data_for_server(data, options)
data ||= {}
options ||= {}
resource_data =
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def initialize(class_name, options)
options = options.is_a?(Hash) ? options : {}
@name, @options = class_name, options
- 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 save
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def save(relative_path = nil, data = {}, options = {})
resource_data = resource_data_for_server(data, options)
method = new_record? ? :create : :update
- 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 populate_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def populate_options(object, options)
options ||= {}
ClassMethods::OPTIONS.each do |option, default|
options[option] ||= object.send(option)
- 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 typhoeus_request_args
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def typhoeus_request_args(http_verb, relative_path, params, body, options)
Method request_configuration
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def request_configuration(request, request_options, options, params, body)
Method make_the_call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_the_call(http_verb, resource_path, params, body, options)
Method make_the_call
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_the_call(http_verb, resource_path, params, body, options)
Method cast_to_type
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def cast_to_type(name, value, parent_object)
type, known_attribute, unknown_hash_class = extract_args(parent_object.class, name)
return Helpers.duplicate(value) if known_attribute && type.nil?
- 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 destroy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def destroy(relative_path = nil, data = {}, options = {})
return false unless persisted?
resource_data = resource_data_for_server(data, options)
- 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 assign_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def assign_attributes(attributes = {}, options = {})
attributes = _extract_attributes(attributes)
return nil unless attributes.is_a?(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
Avoid too many return
statements within this method. Open
return buffer.chop
Method resource_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resource_path(relative_path, options)
resources_name = options[:resources_name] || self.resources_name
if Helpers.present?(resources_name)
Helpers.present?(relative_path) ? "#{resources_name}/#{relative_path}" : resources_name
- 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 find
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find(relative_path, data = {}, options = {})
relative_path = '' if relative_path == :all
get(relative_path, data, options) do |remote_call|
if remote_call.ok?
- 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 resource_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def resource_path(relative_path)
if Helpers.absolute_path?(relative_path)
Helpers.remove_initial_slash(relative_path)
elsif persisted?
id = Helpers.primary_key(self)
- 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"