Showing 11 of 13 total issues
Method multiupload_field
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def multiupload_field(name)
attr_name = :"#{name}"
attr_curr = :"current_#{name}"
attr_prev = :"previous_#{name}"
Method attachment_multiple
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def attachment_multiple(file_url = nil, file_name = nil, file_path = nil, removable = false, media_type = nil)
image = content_tag :img, nil, src: file_url || image_url('upload'), data: { mime_match: 'image/*', dz_thumbnail: '' }
video = content_tag :img, nil, src: image_url('video'), data: { mime_match: 'video/*' }
file = content_tag :img, nil, src: image_url('file'), data: { mime_match: '*/*' }
fname = content_tag :span, file_name, class: 'filename', data: { dz_name: '' }
Method multiupload_field
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def multiupload_field(name)
attr_name = :"#{name}"
attr_curr = :"current_#{name}"
attr_prev = :"previous_#{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 existing_attachments
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def existing_attachments
attribute = object.send(attribute_name)
thumb_size = input_options.fetch :thumbnail_size, :small
if multiple?
- 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 attachment_urls
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attachment_urls
media = nil
if object.is_a? ::ActiveRecord::Base
media = object.try(attribute_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 attachment_preview
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def attachment_preview(file_url = nil)
image = content_tag :img, nil, src: file_url || image_url('upload'), data: { mime_match: 'image/*', replace: 'src' }
video = content_tag :img, nil, src: image_url('video'), data: { mime_match: 'video/*' }
file = content_tag :img, nil, src: image_url('file'), data: { mime_match: '*/*' }
- 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 attachment_multiple
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def attachment_multiple(file_url = nil, file_name = nil, file_path = nil, removable = false, media_type = nil)
Method attachment_preview
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def attachment_preview(file_url = nil)
data = { src: 'file.preview.url', src_alt: 'file.url', url: "#{template.root_url.chomp('/')}[src]" }
image = content_tag :img, nil, src: file_url, class: 'width-100', data: { mime_match: 'image/*', replace: 'src' }
video = content_tag :video, nil, src: file_url, class: 'width-100', controls: true, data: { mime_match: 'video/*', replace: 'src' }
- 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 attachment_record
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def attachment_record
medium = nil
if object.is_a? ::ActiveRecord::Base
medium = object.try(attribute_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 attachment_multiple
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def attachment_multiple(file_url = nil, file_name = nil, file_path = nil, removable = false, media_type = nil)
image = content_tag :img, nil, src: file_url || image_url('upload'), data: { mime_match: 'image/*', dz_thumbnail: '' }
video = content_tag :img, nil, src: image_url('video'), data: { mime_match: 'video/*' }
file = content_tag :img, nil, src: image_url('file'), data: { mime_match: '*/*' }
fname = content_tag :span, file_name, class: 'filename', data: { dz_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 admin_shortcode_assets
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def admin_shortcode_assets
assets = ActionAdmin.config.shortcode_assets.map do |asset|
type = asset.split('.').last
type == 'css' ? stylesheet_link_tag(asset) : javascript_include_tag(asset)
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"