Showing 7 of 9 total issues
Class Builder
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Builder < ActionView::Helpers::FormBuilder
class_attribute :control_class
self.control_class = Control
Class CrudController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class CrudController < ListController
class_attribute :permitted_attrs
# Defines before and after callback hooks for create, update, save and
Method detect_field_method
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def detect_field_method
if type == :text
:text_area
elsif association_kind?(:belongs_to)
:belongs_to_field
- 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 select_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def select_options(attr, **options)
prompt = options.delete(:prompt)
blank = options.delete(:include_blank)
if options[: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 align_class
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def align_class(attr)
entry = entries.present? ? entry_class.new : nil
case column_type(entry, attr)
when :integer, :float, :decimal
'right' unless association(entry, attr, :belongs_to)
- 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 list_entries
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def list_entries
sortable = sortable?(params[:sort])
if sortable || default_sort
clause = [sortable ? sort_expression : nil, default_sort]
super.reorder(Arel.sql(clause.compact.join(', ')))
- 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 edit_action_col
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def edit_action_col(**html_options, &block)
action_col do |entry|
path = action_path(entry, &block)
if path
path = edit_polymorphic_path(path) unless path.is_a?(String)
- 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"