Showing 10 of 212 total issues
Method included
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.included(base)
base.extend ClassMethods
assert_secure_validations_api!(base)
base.class_eval do
- 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 handle_password_change
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def handle_password_change
return if warden.nil?
if !devise_controller? &&
!ignore_password_expire? &&
- 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 included
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.included(base)
base.extend ClassMethods
assert_secure_validations_api!(base)
base.class_eval do
Method validate_each
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_each(record, attribute, password)
return if password.blank?
options.sort.each do |pattern_name, minimum|
normalized_option = pattern_name.to_s.singularize.to_sym
- 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 apply
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def apply
Devise::PasswordsController.send(:include, Patches::ControllerCaptcha) if Devise.captcha_for_recover || Devise.security_question_for_recover
Devise::UnlocksController.send(:include, Patches::ControllerCaptcha) if Devise.captcha_for_unlock || Devise.security_question_for_unlock
Devise::ConfirmationsController.send(:include, Patches::ControllerCaptcha) if Devise.captcha_for_confirmation
- 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 update_with_password
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_with_password(params, *options)
current_password = params.delete(:current_password)
valid_password = valid_password?(current_password)
new_password = params[:password]
- 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 handle_paranoid_verification
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def handle_paranoid_verification
return if warden.nil?
if !devise_controller? && !request.format.nil? && request.format.html?
Devise.mappings.keys.flatten.any? do |scope|
- 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 update_password_changed
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def update_password_changed
if defined?(will_save_change_to_attribute?)
return unless (new_record? || will_save_change_to_encrypted_password?) && !will_save_change_to_password_changed_at?
else
return unless (new_record? || encrypted_password_changed?) && !password_changed_at_changed?
- 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 archive_password
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def archive_password
if max_old_passwords.positive?
return true if old_passwords.where(encrypted_password: encrypted_password_was).exists?
old_passwords.create!(encrypted_password: encrypted_password_was) if encrypted_password_was.present?
- 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 email_not_equal_password_validation
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def email_not_equal_password_validation
return if allow_passwords_equal_to_email
return if password.blank? || email.blank? || (!new_record? && !will_save_change_to_encrypted_password?)
- 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"