Showing 57 of 57 total issues
Method field_set_title_from_args
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def field_set_title_from_args(*args) # @private
options = args.extract_options!
options[:name] ||= options.delete(:title)
title = options[: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 create_or_show
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_or_show
@attributes = reflected_attributes if @attributes.empty?
engine = options[:template_engine]
- 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 initialize
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(builder, template, object, object_name, method, options)
Consider simplifying this complex logical expression. Open
return raw_collection if (raw_collection.instance_of?(Array) || raw_collection.instance_of?(Range)) &&
([Array, String].include?(raw_collection.first.class) || raw_collection.first.is_a?(Integer)) &&
!(options.include?(:member_label) || options.include?(:member_value))
Method collection
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def collection
# Return if we have a plain string
return raw_collection if raw_collection.is_a?(String)
# Return if we have an Array of strings, integers or arrays
- 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 validation_limit
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def validation_limit
validation = validations? && validations.find do |validation|
validation.kind == :length
end
if validation
- 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 semantic_errors
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def semantic_errors(*args)
html_options = args.extract_options!
args = args - [:base]
full_errors = args.inject([]) do |array, method|
attribute = localized_string(method, method.to_sym, :label) || humanized_attribute_name(method)
- 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
Avoid too many return
statements within this method. Open
return :phone if method.to_s =~ /(phone|fax)/
Avoid too many return
statements within this method. Open
return :date_select
Avoid too many return
statements within this method. Open
return :select if reflection_for(method)
Avoid too many return
statements within this method. Open
return :email if method.to_s =~ /email/
Avoid too many return
statements within this method. Open
return :url if method.to_s =~ /^url$|^website$|_url$/
Avoid too many return
statements within this method. Open
return :select if column.type == :string && options.key?(:collection)
Avoid too many return
statements within this method. Open
return column.type
Avoid too many return
statements within this method. Open
return :number
Avoid too many return
statements within this method. Open
return :text
Avoid too many return
statements within this method. Open
return :color if method.to_s =~ /color/
Avoid too many return
statements within this method. Open
return :search if method.to_s =~ /^search$/
Avoid too many return
statements within this method. Open
return :number
Avoid too many return
statements within this method. Open
return :time_select