Showing 4 of 4 total issues
Method create_or_update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_or_update(data)
clean_data = data.deep_stringify_keys
if clean_data.key? 'id'
instance = self.class::CHILD_CLASS.get @client, path, clean_data.delete('id')
- 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 subclass_from
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def subclass_from(collection_class, *args)
id, name, options = parse_args(*args)
return subclass_instance_from(collection_class, id) if id
paging_options = options.divide_on('start', 'page_size') if 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 managed_remote
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def managed_remote(path, method = :get, options = {}, payload = nil)
headers_and_params = headers.merge params_from(options)
YAML.safe_load(naked_remote("#{url_stub}#{path}", method, headers_and_params, payload) || '')
rescue *RETRY_EXCEPTIONS => e
@retries ||= 0
- 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 where
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def where(data, limit = nil)
instances = []
find_each do |instance|
if instance.matches? 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"