Method title_image_url
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def title_image_url style = nil
if title_image_present?
if title_image.image.processing? && style != :thumb
title_image.original_image_url_while_processing
else
- 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 replace_image
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def replace_image should_be_title, attribute
old_image = self.images.select { |i| i.is_title == should_be_title }.first
return if old_image && old_image.external_url == self.send(attribute)
self.images.delete old_image if old_image # delete this image from the instance to not cause unique validation errors
image = load_new_image attribute, should_be_title
- 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 store_external_images
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def store_external_images
return if self.errors.any?
replace_image true, :external_title_image_url if external_title_image_url.present?
replace_image false, :image_2_url if image_2_url.present?
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"