diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-11-01 07:32:04 +0900 |
---|---|---|
committer | Ryuta Kamizono <kamipo@gmail.com> | 2017-11-01 07:32:04 +0900 |
commit | 146b1c2e3389bc70ea0b54abf7843fc1d6c8cd5f (patch) | |
tree | e6877230dc7e9f18af128f7bf73180be05f53c64 | |
parent | 3664e9cb798ea47a6ef10088b3fb2a7529b0dc9b (diff) | |
download | rails-146b1c2e3389bc70ea0b54abf7843fc1d6c8cd5f.tar.gz rails-146b1c2e3389bc70ea0b54abf7843fc1d6c8cd5f.tar.bz2 rails-146b1c2e3389bc70ea0b54abf7843fc1d6c8cd5f.zip |
Enable `Style/RedundantReturn` rubocop rule, and fixed a couple more
Follow up of #31004.
-rw-r--r-- | .rubocop.yml | 4 | ||||
-rw-r--r-- | actioncable/lib/action_cable/connection/client_socket.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/adapters/mysql2/active_schema_test.rb | 2 | ||||
-rw-r--r-- | activesupport/lib/active_support/core_ext/numeric/conversions.rb | 14 | ||||
-rw-r--r-- | guides/rails_guides/levenshtein.rb | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index ec33b1ee33..399fc66730 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -136,6 +136,10 @@ Lint/EndAlignment: Lint/RequireParentheses: Enabled: true +Style/RedundantReturn: + Enabled: true + AllowMultipleReturnValues: true + Style/Semicolon: Enabled: true AllowAsExpressionSeparator: true diff --git a/actioncable/lib/action_cable/connection/client_socket.rb b/actioncable/lib/action_cable/connection/client_socket.rb index ba33c8b982..10289ab55c 100644 --- a/actioncable/lib/action_cable/connection/client_socket.rb +++ b/actioncable/lib/action_cable/connection/client_socket.rb @@ -21,7 +21,7 @@ module ActionCable return true if env["HTTP_X_FORWARDED_PROTO"] == "https" return true if env["rack.url_scheme"] == "https" - return false + false end CONNECTING = 0 diff --git a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb index a6b83ec377..4e73c557ed 100644 --- a/activerecord/test/cases/adapters/mysql2/active_schema_test.rb +++ b/activerecord/test/cases/adapters/mysql2/active_schema_test.rb @@ -9,7 +9,7 @@ class Mysql2ActiveSchemaTest < ActiveRecord::Mysql2TestCase def setup ActiveRecord::Base.connection.singleton_class.class_eval do alias_method :execute_without_stub, :execute - def execute(sql, name = nil) return sql end + def execute(sql, name = nil) sql end end end diff --git a/activesupport/lib/active_support/core_ext/numeric/conversions.rb b/activesupport/lib/active_support/core_ext/numeric/conversions.rb index e675f32cd4..f6c2713986 100644 --- a/activesupport/lib/active_support/core_ext/numeric/conversions.rb +++ b/activesupport/lib/active_support/core_ext/numeric/conversions.rb @@ -108,19 +108,19 @@ module ActiveSupport::NumericWithFormat when Integer, String super(format) when :phone - return ActiveSupport::NumberHelper.number_to_phone(self, options || {}) + ActiveSupport::NumberHelper.number_to_phone(self, options || {}) when :currency - return ActiveSupport::NumberHelper.number_to_currency(self, options || {}) + ActiveSupport::NumberHelper.number_to_currency(self, options || {}) when :percentage - return ActiveSupport::NumberHelper.number_to_percentage(self, options || {}) + ActiveSupport::NumberHelper.number_to_percentage(self, options || {}) when :delimited - return ActiveSupport::NumberHelper.number_to_delimited(self, options || {}) + ActiveSupport::NumberHelper.number_to_delimited(self, options || {}) when :rounded - return ActiveSupport::NumberHelper.number_to_rounded(self, options || {}) + ActiveSupport::NumberHelper.number_to_rounded(self, options || {}) when :human - return ActiveSupport::NumberHelper.number_to_human(self, options || {}) + ActiveSupport::NumberHelper.number_to_human(self, options || {}) when :human_size - return ActiveSupport::NumberHelper.number_to_human_size(self, options || {}) + ActiveSupport::NumberHelper.number_to_human_size(self, options || {}) when Symbol super() else diff --git a/guides/rails_guides/levenshtein.rb b/guides/rails_guides/levenshtein.rb index bafa6bfe9d..c48af797fa 100644 --- a/guides/rails_guides/levenshtein.rb +++ b/guides/rails_guides/levenshtein.rb @@ -38,7 +38,7 @@ module RailsGuides d[m] = x end - return x + x end end end |