Method properties_for_relations
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def properties_for_relations(model, visited)
model.relations.each_with_object({}) do |(name, relation), props|
next if visited.include?(relation.relation_class)
next unless relation.is_a?(Association::Embedded::EmbedsOne)
next unless relation.relation_class.encrypted?
- 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 encryption_schema_map
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def encryption_schema_map(default_database, models = ::Mongoid.models)
visited = Set.new
models.each_with_object({}) do |model, map|
next if visited.include?(model)
visited << model
- 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 metadata_for
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def metadata_for(model)
metadata = {}.tap do |metadata|
if (key_id = key_id_for(model.encrypt_metadata[:key_id], model.encrypt_metadata[:key_name_field]))
metadata['keyId'] = key_id
end
- 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 properties_for_fields
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def properties_for_fields(model)
model.fields.each_with_object({}) do |(name, field), props|
next unless field.is_a?(Mongoid::Fields::Encrypted)
props[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 key_id_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def key_id_for(key_id_base64, key_name_field)
return nil if key_id_base64.nil? && key_name_field.nil?
if !key_id_base64.nil? && !key_name_field.nil?
raise ArgumentError, 'Specifying both key_id and key_name_field is not allowed'
end
- 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"