Showing 6 of 14 total issues
Method asset_icon_tag
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def asset_icon_tag extension
icon_name = case extension.downcase
when 'avi' then 'file-movie-o'
when 'css' then 'file-text-o'
when 'csv' then 'file-excel-o'
Method active_facet_list
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def active_facet_list(*facets)
return unless facets and !facets.empty?
output = ActiveSupport::SafeBuffer.new
facets.each do |param|
if params[param] and params[param].is_a?(Array)
- 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 included
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
base.instance_eval do
concern :pageable do
collection do
Method associations
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def associations
errors.add(:base, "An association to a page is required.") unless page_id.present?
errors.add(:base, "An association to a UI Section is required.") unless ui_section_id.present?
errors.add(:base, "An association to a Widget is required.") unless widget_id.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"
Further reading
Method revision_partial_sorter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def revision_partial_sorter
if current_revision? and policy(@revision).approve?
nil
elsif current_revision? and !policy(@revision).approve?
'insufficient_rights'
- 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 sortable
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def sortable(column, title=nil)
title ||= column.humanize
direction = (column.to_s == params[:o] && params[:dir] == "asc" ? "desc" : "asc")
icon = direction == "asc" ? icon_tag('caret-up') : icon_tag('caret-down')
"#{title} #{link_to(icon, params.merge({o: column, dir: direction}))}".html_safe
- 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"