From c81af6ae723ccfcd601032167d7b7f57c5449c33 Mon Sep 17 00:00:00 2001 From: Ryuta Kamizono Date: Wed, 12 Jun 2019 21:30:49 +0900 Subject: Enable `Layout/EmptyLinesAroundAccessModifier` cop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost. --- activerecord/test/models/club.rb | 1 - activerecord/test/models/company.rb | 1 - activerecord/test/models/company_in_module.rb | 1 - activerecord/test/models/person.rb | 1 - activerecord/test/models/topic.rb | 1 - 5 files changed, 5 deletions(-) (limited to 'activerecord/test/models') diff --git a/activerecord/test/models/club.rb b/activerecord/test/models/club.rb index bb49fb300c..890e427616 100644 --- a/activerecord/test/models/club.rb +++ b/activerecord/test/models/club.rb @@ -15,7 +15,6 @@ class Club < ActiveRecord::Base accepts_nested_attributes_for :membership private - def private_method "I'm sorry sir, this is a *private* club, not a *pirate* club" end diff --git a/activerecord/test/models/company.rb b/activerecord/test/models/company.rb index a0f48d23f1..339b5c8ca8 100644 --- a/activerecord/test/models/company.rb +++ b/activerecord/test/models/company.rb @@ -25,7 +25,6 @@ class Company < AbstractCompany end private - def private_method "I am Jack's innermost fears and aspirations" end diff --git a/activerecord/test/models/company_in_module.rb b/activerecord/test/models/company_in_module.rb index 52b7e06a63..320b26b950 100644 --- a/activerecord/test/models/company_in_module.rb +++ b/activerecord/test/models/company_in_module.rb @@ -91,7 +91,6 @@ module MyApplication validate :check_empty_credit_limit private - def check_empty_credit_limit errors.add("credit_card", :blank) if credit_card.blank? end diff --git a/activerecord/test/models/person.rb b/activerecord/test/models/person.rb index c3d15a571a..0dfd29e45e 100644 --- a/activerecord/test/models/person.rb +++ b/activerecord/test/models/person.rb @@ -101,7 +101,6 @@ class RichPerson < ActiveRecord::Base before_validation :run_before_validation private - def run_before_create self.first_name = first_name.to_s + "run_before_create" end diff --git a/activerecord/test/models/topic.rb b/activerecord/test/models/topic.rb index 77101090f2..7a864c728c 100644 --- a/activerecord/test/models/topic.rb +++ b/activerecord/test/models/topic.rb @@ -93,7 +93,6 @@ class Topic < ActiveRecord::Base end private - def default_written_on self.written_on = Time.now unless attribute_present?("written_on") end -- cgit v1.2.3