Showing 13 of 22 total issues
Method upgraded_attributes
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_attributes
{
'size' => {
'searchable' => false,
'translatable' => false,
Method promethee_sanitize_attributes
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def promethee_sanitize_attributes(attributes)
attributes.each do |key, value_object|
case value_object['type']
when 'string'
while value_object['value'] != Loofah.fragment(value_object['value']).text(encode_special_chars: false)
- 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 upgraded_backgrounds
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_backgrounds(backgrounds)
backgrounds ||= []
backgrounds.map { |background|
{
'image' => {
Method upgraded_attributes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_attributes
{
'title' => {
'searchable' => true,
'translatable' => true,
Method upgraded_attributes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_attributes
{
'visible_content' => {
'searchable' => true,
'translatable' => true,
Method upgraded_attributes
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_attributes
{
'caption' => {
'searchable' => true,
'translatable' => true,
Method upgraded_attributes
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_attributes
{
'caption' => {
'searchable' => true,
'translatable' => true,
Method upgraded_attributes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_attributes
{
'image' => {
'searchable' => false,
'translatable' => false,
Method upgraded_attributes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def upgraded_attributes
{
'image' => {
'searchable' => false,
'translatable' => false,
Method promethee_extract_searchable_attributes
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def promethee_extract_searchable_attributes(attributes)
searchable = ' '
attributes.each do |key, value_object|
if value_object['searchable']
clean_value = strip_tags value_object['value']
- 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 blob_show
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def blob_show
# as this is called only from promethee preview it sends an image resized to 720
begin
blob_find_method = ActiveStorage::Blob.respond_to?(:find_signed!) ? :find_signed! : :find_signed
blob = ActiveStorage::Blob.public_send(blob_find_method, params[: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 blob_from_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def blob_from_data(blob_data = {})
return unless blob_data&.has_key? :id
blob_find_method = ActiveStorage::Blob.respond_to?(:find_signed!) ? :find_signed! : :find_signed
ActiveStorage::Blob.public_send blob_find_method, blob_data[:id]
rescue
- 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 upgrade_attribute
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def upgrade_attribute(attribute_value)
return upgrade_blob_data(attribute_value) if is_blob_data?(attribute_value)
if attribute_value.is_a? Array
attribute_value.map { |item| upgrade_attribute(item) }
- 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"