Showing 16 of 16 total issues
Method block
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def block(method = nil, options = {}, &block)
options[:error] ||= error(method) if method
components = "".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"
Further reading
Method input
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def input(method, options = {})
options[:as] ||= as(method)
options[:input] ||= {}
return hidden_field method, options[:input] if options[:as] == :hidden
- 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 association
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def association(method, collection, value, text, options = {})
options[:as] ||= :select
options[:association] ||= {}
klass = [::Formula.association_class, options[:as]]
- 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 association
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def association(method, collection, value, text, options = {})
Avoid too many return
statements within this method. Open
when :string then return :string
Avoid too many return
statements within this method. Open
when :decimal then return :number
Avoid too many return
statements within this method. Open
when :integer then return :number
Avoid too many return
statements within this method. Open
when :datetime then return :datetime
Avoid too many return
statements within this method. Open
when :text then return :text
Avoid too many return
statements within this method. Open
when :date then return :date
Avoid too many return
statements within this method. Open
when :time then return :time
Avoid too many return
statements within this method. Open
return ::Formula.default_as
Avoid too many return
statements within this method. Open
return :file if file?(method)
Avoid too many return
statements within this method. Open
when :timestamp then return :datetime
Avoid too many return
statements within this method. Open
when :float then return :number
Method type
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def type(method)
if @object.respond_to?(:has_attribute?) && @object.has_attribute?(method)
column = @object.column_for_attribute(method) if @object.respond_to?(:column_for_attribute)
return column.type if column
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"