Method unembed_relationships
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def unembed_relationships(data, target, field)
return data unless defined?(target.class::RELATIONSHIPS)
relationships = target.class::RELATIONSHIPS
data.each do |k, v|
- 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 validate_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def validate_data(content_type)
if request.post? || request.patch?
raise(Errors::BadRequestError) unless request.content_type == content_type
request_load_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 request_cast_attribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def request_cast_attribute(target, attributes, types, key, value)
Method validate_reference
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_reference(expected, id, sanitized, type)
raise("Relationship does not contain the \"data.type\" attribute") if type.blank?
raise("Relationship does not contain the \"data.id\" attribute") if id.blank?
raise("Invalid relationship type \"#{type}\" provided for when type \"#{expected}\" was expected.") unless sanitized == sanitize_model_name(expected)
- 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"