Class ContentEntryRepository
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentEntryRepository
include Models::Repository
attr_accessor :content_type_repository, :content_type
Method _prepare
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _prepare(fields, &block)
fields.each do |field|
name = field.name.to_s
operator = @operators[name]
_name = operator ? "#{name}.#{operator}" : 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 value_to_id
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def value_to_id(value, target_id)
return values_to_ids(value, target_id) if value.kind_of?(Array)
_value = if value.is_a?(Hash)
value['_id'] || value[:_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 value_for
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def value_for(entry, name, conditions = {})
return nil if entry.nil?
if field = content_type.fields_by_name[name]
value = entry.send(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 next_or_previous
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def next_or_previous(entry, asc_op, desc_op)
return nil if entry.nil?
with(entry.content_type)
- 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"