From 78c209a693a3b91d9743286ee1198fff02eec35f Mon Sep 17 00:00:00 2001 From: Yasuo Honda Date: Wed, 27 Nov 2019 23:53:47 +0000 Subject: [PATCH] Bump RuboCop version to 0.77 https://github.com/rubocop-hq/rubocop/releases/tag/v0.77.0 * Update cop names to changed as follows: ``` $ bundle exec rubocop Error: The `Layout/IndentFirstArgument` cop has been renamed to `Layout/FirstArgumentIndentation`. (obsolete configuration found in .rubocop.yml, please update it) The `Layout/TrailingBlankLines` cop has been renamed to `Layout/TrailingEmptyLines`. (obsolete configuration found in .rubocop.yml, please update it) The `Lint/StringConversionInInterpolation` cop has been renamed to `Lint/RedundantStringCoercion`. (obsolete configuration found in .rubocop.yml, please update it) $ ``` * Auto correct these offenses: ``` $ bundle exec rubocop -a ... snip ... Offenses: activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb:104:11: C: [Corrected] Style/RedundantReturn: Redundant return detected. return true ^^^^^^ activerecord/lib/active_record/reflection.rb:622:15: C: [Corrected] Style/RedundantReturn: Redundant return detected. return inverse_name ^^^^^^ activerecord/lib/active_record/table_metadata.rb:48:9: C: [Corrected] Style/RedundantReturn: Redundant return detected. return self ^^^^^^ 2812 files inspected, 3 offenses detected, 3 offenses corrected $ ``` --- .rubocop.yml | 8 ++++---- Gemfile.lock | 4 ++-- .../active_record/connection_adapters/sqlite3_adapter.rb | 2 +- activerecord/lib/active_record/reflection.rb | 2 +- activerecord/lib/active_record/table_metadata.rb | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 1a722e621e..266e384f75 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -82,7 +82,7 @@ Layout/EmptyLinesAroundModuleBody: Style/HashSyntax: Enabled: true -Layout/IndentFirstArgument: +Layout/FirstArgumentIndentation: Enabled: true # Method definitions after `private` or `protected` isolated calls need one @@ -170,8 +170,8 @@ Style/StringLiterals: Layout/Tab: Enabled: true -# Blank lines should not have any spaces. -Layout/TrailingBlankLines: +# Empty lines should not have any spaces. +Layout/TrailingEmptyLines: Enabled: true # No trailing whitespace. @@ -198,7 +198,7 @@ Lint/RequireParentheses: Lint/ShadowingOuterLocalVariable: Enabled: true -Lint/StringConversionInInterpolation: +Lint/RedundantStringCoercion: Enabled: true Lint/UriEscapeUnescape: diff --git a/Gemfile.lock b/Gemfile.lock index 0b47f39ec8..9ef915d39f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -348,7 +348,7 @@ GEM nokogiri (1.10.4-x86-mingw32) mini_portile2 (~> 2.4.0) os (1.0.1) - parallel (1.19.0) + parallel (1.19.1) parser (2.6.5.0) ast (~> 2.4.0) path_expander (1.1.0) @@ -408,7 +408,7 @@ GEM resque (>= 1.26) rufus-scheduler (~> 3.2) retriable (3.1.2) - rubocop (0.76.0) + rubocop (0.77.0) jaro_winkler (~> 1.5.1) parallel (~> 1.10) parser (>= 2.6) diff --git a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb index 14184947d3..a87312d95b 100644 --- a/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb @@ -101,7 +101,7 @@ module ActiveRecord def self.database_exists?(config) config = config.symbolize_keys if config[:database] == ":memory:" - return true + true else database_file = defined?(Rails.root) ? File.expand_path(config[:database], Rails.root) : config[:database] File.exist?(database_file) diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 78cd5a0e6c..e986d8b6f1 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -619,7 +619,7 @@ module ActiveRecord end if valid_inverse_reflection?(reflection) - return inverse_name + inverse_name end end end diff --git a/activerecord/lib/active_record/table_metadata.rb b/activerecord/lib/active_record/table_metadata.rb index 9a1176db6a..61483813d4 100644 --- a/activerecord/lib/active_record/table_metadata.rb +++ b/activerecord/lib/active_record/table_metadata.rb @@ -45,7 +45,7 @@ module ActiveRecord association = klass._reflect_on_association(table_name) || klass._reflect_on_association(table_name.to_s.singularize) if !association && table_name == arel_table.name - return self + self elsif association && !association.polymorphic? association_klass = association.klass arel_table = association_klass.arel_table.alias(table_name)