Add and apply Style/RedundantSelf rubocop rule
This commit is contained in:
@@ -499,6 +499,9 @@ Style/RedundantParentheses:
|
|||||||
Style/RedundantReturn:
|
Style/RedundantReturn:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
Style/RedundantSelf:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
Style/SafeNavigation:
|
Style/SafeNavigation:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class AdminNotification < ApplicationRecord
|
|||||||
return unless link.present?
|
return unless link.present?
|
||||||
|
|
||||||
unless link =~ /\A(http:\/\/|https:\/\/|\/)/
|
unless link =~ /\A(http:\/\/|https:\/\/|\/)/
|
||||||
self.link = "http://#{self.link}"
|
self.link = "http://#{link}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -364,11 +364,11 @@ class Budget
|
|||||||
end
|
end
|
||||||
|
|
||||||
def assigned_valuators
|
def assigned_valuators
|
||||||
self.valuators.map(&:description_or_name).compact.join(", ").presence
|
valuators.map(&:description_or_name).compact.join(", ").presence
|
||||||
end
|
end
|
||||||
|
|
||||||
def assigned_valuation_groups
|
def assigned_valuation_groups
|
||||||
self.valuator_groups.map(&:name).compact.join(", ").presence
|
valuator_groups.map(&:name).compact.join(", ").presence
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.with_milestone_status_id(status_id)
|
def self.with_milestone_status_id(status_id)
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ class Budget
|
|||||||
include Imageable
|
include Imageable
|
||||||
|
|
||||||
belongs_to :budget, touch: true
|
belongs_to :budget, touch: true
|
||||||
belongs_to :next_phase, class_name: self.name, inverse_of: :prev_phase
|
belongs_to :next_phase, class_name: name, inverse_of: :prev_phase
|
||||||
has_one :prev_phase, class_name: self.name, foreign_key: :next_phase_id, inverse_of: :next_phase
|
has_one :prev_phase, class_name: name, foreign_key: :next_phase_id, inverse_of: :next_phase
|
||||||
|
|
||||||
validates_translation :name, presence: true
|
validates_translation :name, presence: true
|
||||||
validates_translation :description, length: { maximum: DESCRIPTION_MAX_LENGTH }
|
validates_translation :description, length: { maximum: DESCRIPTION_MAX_LENGTH }
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module Globalizable
|
|||||||
translated_attribute_names.any? { |attr| required_attribute?(attr) }
|
translated_attribute_names.any? { |attr| required_attribute?(attr) }
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.paranoid? && translation_class.attribute_names.include?("hidden_at")
|
if paranoid? && translation_class.attribute_names.include?("hidden_at")
|
||||||
translation_class.send :acts_as_paranoid, column: :hidden_at
|
translation_class.send :acts_as_paranoid, column: :hidden_at
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ class LocalCensusRecord < ApplicationRecord
|
|||||||
private
|
private
|
||||||
|
|
||||||
def sanitize
|
def sanitize
|
||||||
self.document_type = self.document_type&.strip
|
self.document_type = document_type&.strip
|
||||||
self.document_number = self.document_number&.strip
|
self.document_number = document_number&.strip
|
||||||
self.postal_code = self.postal_code&.strip
|
self.postal_code = postal_code&.strip
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -58,6 +58,6 @@ class ProposalNotification < ApplicationRecord
|
|||||||
private
|
private
|
||||||
|
|
||||||
def set_author
|
def set_author
|
||||||
self.update(author_id: self.proposal.author_id) if self.proposal
|
update(author_id: proposal.author_id) if proposal
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class RelatedContent < ApplicationRecord
|
|||||||
belongs_to :author, class_name: "User"
|
belongs_to :author, class_name: "User"
|
||||||
belongs_to :parent_relationable, polymorphic: true, optional: false, touch: true
|
belongs_to :parent_relationable, polymorphic: true, optional: false, touch: true
|
||||||
belongs_to :child_relationable, polymorphic: true, optional: false, touch: true
|
belongs_to :child_relationable, polymorphic: true, optional: false, touch: true
|
||||||
has_one :opposite_related_content, class_name: self.name, foreign_key: :related_content_id
|
has_one :opposite_related_content, class_name: name, foreign_key: :related_content_id
|
||||||
has_many :related_content_scores, dependent: :destroy
|
has_many :related_content_scores, dependent: :destroy
|
||||||
|
|
||||||
validates :parent_relationable_id, uniqueness: { scope: [:parent_relationable_type, :child_relationable_id, :child_relationable_type] }
|
validates :parent_relationable_id, uniqueness: { scope: [:parent_relationable_type, :child_relationable_id, :child_relationable_type] }
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ module Devise
|
|||||||
module Models
|
module Models
|
||||||
module PasswordExpirable
|
module PasswordExpirable
|
||||||
def need_change_password?
|
def need_change_password?
|
||||||
self.administrator? && password_expired?
|
administrator? && password_expired?
|
||||||
end
|
end
|
||||||
|
|
||||||
def password_expired?
|
def password_expired?
|
||||||
self.password_changed_at < self.expire_password_after.ago
|
password_changed_at < expire_password_after.ago
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -60,11 +60,11 @@ module Devise
|
|||||||
end
|
end
|
||||||
|
|
||||||
def current_equal_password_validation
|
def current_equal_password_validation
|
||||||
if !self.new_record? && !self.encrypted_password_change.nil? && !self.erased?
|
if !new_record? && !encrypted_password_change.nil? && !erased?
|
||||||
dummy = self.class.new
|
dummy = self.class.new
|
||||||
dummy.encrypted_password = self.encrypted_password_change.first
|
dummy.encrypted_password = encrypted_password_change.first
|
||||||
dummy.password_salt = self.password_salt_change.first if self.respond_to?(:password_salt_change) && !self.password_salt_change.nil?
|
dummy.password_salt = password_salt_change.first if respond_to?(:password_salt_change) && !password_salt_change.nil?
|
||||||
self.errors.add(:password, :equal_to_current_password) if dummy.valid_password?(self.password)
|
errors.add(:password, :equal_to_current_password) if dummy.valid_password?(password)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user