Showing 11 of 17 total issues
Method client_side_hash
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def client_side_hash(model, attribute, force = nil)
options = self.options.dup
hash = options_hash(model, attribute, options)
@@option_map.each do |option, message_type|
- 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
Function add
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: ($element, settings, message) => {
const element = $element[0]
const form = element.form
Method client_side_hash
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def client_side_hash(model, attribute, force = nil)
options = self.options.dup
if options[:with].respond_to?(:call)
return unless force
- 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
Function add
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
add: ($element, settings, message) => {
const element = $element[0]
const form = element.form
- 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 client_side_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def client_side_hash(model, attribute, _force = nil)
options = self.options.dup
hash = options_hash(options)
self.class::MESSAGES.each do |option, message_type|
- 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 build_validation_options
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_validation_options(method, options = {})
return unless @options[:validate]
index = @default_options[:index].present? ? "[#{@default_options[:index]}]" : ''
child_index = @options[:child_index] ? "(\\d+|#{Regexp.escape(@options[:child_index].to_s)})" : '\\d+'
- 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 check_record
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_record(record, options)
case record
when String, Symbol
raise ClientSideValidations::ActionView::Helpers::FormHelper::Error, 'Using form_for(:name, @resource) is not supported with ClientSideValidations. Please use form_for(@resource, as: :name) instead.'
else
- 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 form_tag_with_validators
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def form_tag_with_validators(scope, model, options, url, &block)
Method client_side_validation_hash
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def client_side_validation_hash(force = nil)
_validators.inject({}) do |attr_hash, attr|
next attr_hash if ATTRIBUTES_DENYLIST.include?(attr[0])
validator_hash = validator_hash_for(attr, force)
- 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 validator_hash_for
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validator_hash_for(attr, force)
attr[1].each_with_object(Hash.new { |h, k| h[k] = [] }) do |validator, kind_hash|
next unless can_use_for_client_side_validation?(attr[0], validator, force)
client_side_hash = validator.client_side_hash(self, attr[0], extract_force_option(attr[0], force))
- 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 check_conditionals
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def check_conditionals(attr, validator, force)
return true if validator.options[:if] && will_save_change?(validator.options[:if])
result = can_force_validator?(attr, validator, force)
- 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"