diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-05-21 21:04:01 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2018-05-21 21:10:14 +0900 |
commit | a77447f4da15dd3c2b02563fa6f5769c1d91e1bd (patch) | |
tree | 6f1b8ba09df3b8b938a3c5238eddbf3bd2501d3a | |
parent | 15d00f04f40604842f9d6c86762b27d9a94e896e (diff) | |
download | rails-a77447f4da15dd3c2b02563fa6f5769c1d91e1bd.tar.gz rails-a77447f4da15dd3c2b02563fa6f5769c1d91e1bd.tar.bz2 rails-a77447f4da15dd3c2b02563fa6f5769c1d91e1bd.zip |
Enable `Lint/StringConversionInInterpolation` rubocop rule
To prevent redundant `to_s` like https://github.com/rails/rails/pull/32923#discussion_r189460008
automatically in the future.
-rw-r--r-- | .rubocop.yml | 3 | ||||
-rw-r--r-- | activerecord/lib/active_record/log_subscriber.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/arel/support/fake_record.rb | 4 | ||||
-rw-r--r-- | railties/test/application/server_test.rb | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 954ab3b1cb..7327f1e631 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -162,6 +162,9 @@ Style/UnneededPercentQ: Lint/RequireParentheses: Enabled: true +Lint/StringConversionInInterpolation: + Enabled: true + Style/RedundantReturn: Enabled: true AllowMultipleReturnValues: true diff --git a/activerecord/lib/active_record/log_subscriber.rb b/activerecord/lib/active_record/log_subscriber.rb index 013c3765b2..cf884bc6da 100644 --- a/activerecord/lib/active_record/log_subscriber.rb +++ b/activerecord/lib/active_record/log_subscriber.rb @@ -104,7 +104,7 @@ module ActiveRecord if source_line if defined?(::Rails.root) - app_root = "#{::Rails.root.to_s}/".freeze + app_root = "#{::Rails.root}/" source_line = source_line.sub(app_root, "") end diff --git a/activerecord/test/cases/arel/support/fake_record.rb b/activerecord/test/cases/arel/support/fake_record.rb index 8620d6fd34..559ff5d4e6 100644 --- a/activerecord/test/cases/arel/support/fake_record.rb +++ b/activerecord/test/cases/arel/support/fake_record.rb @@ -51,11 +51,11 @@ module FakeRecord end def quote_table_name(name) - "\"#{name.to_s}\"" + "\"#{name}\"" end def quote_column_name(name) - "\"#{name.to_s}\"" + "\"#{name}\"" end def schema_cache diff --git a/railties/test/application/server_test.rb b/railties/test/application/server_test.rb index f3a7e00a4d..92b991dd05 100644 --- a/railties/test/application/server_test.rb +++ b/railties/test/application/server_test.rb @@ -36,7 +36,7 @@ module ApplicationTests skip "PTY unavailable" unless available_pty? File.open("#{app_path}/config/boot.rb", "w") do |f| - f.puts "ENV['BUNDLE_GEMFILE'] = '#{Bundler.default_gemfile.to_s}'" + f.puts "ENV['BUNDLE_GEMFILE'] = '#{Bundler.default_gemfile}'" f.puts "require 'bundler/setup'" end |