Class ContentEntry
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class ContentEntry < Base
## fields ##
field :_slug, localized: true
field :_position, default: 0
Method to_hash
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def to_hash(nested = true)
# no need of _position and _visible (unless it's false)
hash = super.delete_if { |k, v| k == '_position' || (k == '_visible' && v == true) }
# also no need of the 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"
Further reading
Method set_slug
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_slug
self.translated_in.each do |locale|
Locomotive::Mounter.with_locale(locale) do
# first attempt from the label
if self._slug.blank?
- 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 dynamic_getter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def dynamic_getter(name)
field = self.content_type.find_field(name)
value = self.localized_dynamic_attribute_value(field)
case field.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"
Further reading
Method localized_dynamic_attribute_value
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def localized_dynamic_attribute_value(field)
if field.is_a?(String)
field = self.content_type.find_field(field)
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 dynamic_setter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def dynamic_setter(name, value)
self.dynamic_attributes ||= {}
self.dynamic_attributes[name.to_sym] ||= {}
field = self.content_type.find_field(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"