Apply Style/AndOr and Style/Not rubocop rules
The `and` and `or` keywords are not equivalent to `&&` and `||` and its use is counterintuitive. Here's an example ``` good = true && false # good if false bad = true and false # bad is true ``` The reason is `and` and `or` are control flow operators. So the code: ``` bad = true and false ``` Is equivalent to: ``` if bad = true false end ```
This commit is contained in:
@@ -367,9 +367,15 @@ Security/JSONLoad:
|
|||||||
Security/YAMLLoad:
|
Security/YAMLLoad:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Style/AndOr:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Style/BlockDelimiters:
|
Style/BlockDelimiters:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Style/Not:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Style/PercentLiteralDelimiters:
|
Style/PercentLiteralDelimiters:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ module Devise
|
|||||||
if !self.new_record? && !self.encrypted_password_change.nil? && !self.erased?
|
if !self.new_record? && !self.encrypted_password_change.nil? && !self.erased?
|
||||||
dummy = self.class.new
|
dummy = self.class.new
|
||||||
dummy.encrypted_password = self.encrypted_password_change.first
|
dummy.encrypted_password = self.encrypted_password_change.first
|
||||||
dummy.password_salt = self.password_salt_change.first if self.respond_to? :password_salt_change and not self.password_salt_change.nil?
|
dummy.password_salt = self.password_salt_change.first if self.respond_to?(:password_salt_change) && !self.password_salt_change.nil?
|
||||||
self.errors.add(:password, :equal_to_current_password) if dummy.valid_password?(self.password)
|
self.errors.add(:password, :equal_to_current_password) if dummy.valid_password?(self.password)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user