From 7d05311ee1de60e5331c55799fae956fcd932bc2 Mon Sep 17 00:00:00 2001 From: Daniel O'Connor Date: Tue, 10 Jan 2017 16:16:06 +1030 Subject: [PATCH] Rubocop: Redundant self --- .rubocop_todo.yml | 8 -------- app/models/users/user.rb | 2 +- db/migrate/20100928030620_remove_uuid.rb | 2 +- lib/fat_free_crm/fields.rb | 2 +- 4 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 283a2af2fb..ee9dbc4d75 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -467,14 +467,6 @@ Style/PredicateName: - 'lib/fat_free_crm/fields.rb' - 'lib/fat_free_crm/mail_processor/base.rb' -# Offense count: 3 -# Cop supports --auto-correct. -Style/RedundantSelf: - Exclude: - - 'app/models/users/user.rb' - - 'db/migrate/20100928030620_remove_uuid.rb' - - 'lib/fat_free_crm/fields.rb' - # Offense count: 18 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, SupportedStyles, AllowInnerSlashes. diff --git a/app/models/users/user.rb b/app/models/users/user.rb index 6b838f55c9..9e3421f877 100644 --- a/app/models/users/user.rb +++ b/app/models/users/user.rb @@ -105,7 +105,7 @@ def suspended? #---------------------------------------------------------------------------- def awaits_approval? - self.suspended? && login_count == 0 && Setting.user_signup == :needs_approval + suspended? && login_count == 0 && Setting.user_signup == :needs_approval end #---------------------------------------------------------------------------- diff --git a/db/migrate/20100928030620_remove_uuid.rb b/db/migrate/20100928030620_remove_uuid.rb index 0dbb9dc5b8..f6900da34d 100644 --- a/db/migrate/20100928030620_remove_uuid.rb +++ b/db/migrate/20100928030620_remove_uuid.rb @@ -4,7 +4,7 @@ class RemoveUuid < ActiveRecord::Migration def self.up [:users, :accounts, :campaigns, :leads, :contacts, :opportunities, :tasks].each do |table| remove_column table, :uuid - execute("DROP TRIGGER IF EXISTS #{table}_uuid") if self.uuid_configured? + execute("DROP TRIGGER IF EXISTS #{table}_uuid") if uuid_configured? end end diff --git a/lib/fat_free_crm/fields.rb b/lib/fat_free_crm/fields.rb index f918f72ebb..a26ddff785 100755 --- a/lib/fat_free_crm/fields.rb +++ b/lib/fat_free_crm/fields.rb @@ -79,7 +79,7 @@ def method_missing(method_id, *args, &block) # Refresh columns and try again. self.class.reset_column_information # If new record, create new object from class, else reload class - object = self.new_record? ? self.class.new : (reload && self) + object = new_record? ? self.class.new : (reload && self) # ensure serialization is setup if needed self.class.serialize_custom_fields! # Try again if object now responds to method, else return nil