Showing 51 of 57 total issues
Avoid too many return
statements within this method. Open
return :password if method.to_s =~ /password/
Avoid too many return
statements within this method. Open
return :select if enum_for(method)
Avoid too many return
statements within this method. Open
return :datetime_select
Avoid too many return
statements within this method. Open
return :string
Avoid too many return
statements within this method. Open
return :string
Method errors
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def errors
errors = []
if object && object.respond_to?(:errors)
error_keys.each do |key|
errors << object.errors[key] unless object.errors[key].blank?
- 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 save_to_clipboard
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def save_to_clipboard(data)
return unless data
begin
case RUBY_PLATFORM
- 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 humanized_attribute_name
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def humanized_attribute_name(method)
if @object && @object.class.respond_to?(:human_attribute_name)
humanized_name = @object.class.human_attribute_name(method.to_s)
if humanized_name == method.to_s.send(:humanize)
method.to_s.send(label_str_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
Method escape_html_entities
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def escape_html_entities(string) # @private
if (builder.escape_html_entities_in_hints_and_labels) ||
(self.respond_to?(:escape_html_entities_in_hints_and_labels) && escape_html_entities_in_hints_and_labels)
string = builder.template.escape_once(string) unless string.respond_to?(:html_safe?) && string.html_safe? == true # Accept html_safe flag as indicator to skip escaping
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 make_selected_values
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def make_selected_values
if object.respond_to?(method)
selected_items = object.send(method)
# Construct an array from the return value, regardless of the return type
selected_items = [*selected_items].compact.flatten
- 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_step
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validation_step
validation = validations? && validations.find do |validation|
validation.kind == :numericality
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"