aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.rubocop.yml3
-rw-r--r--actionview/lib/action_view/helpers/text_helper.rb2
-rw-r--r--actionview/test/template/text_helper_test.rb2
-rw-r--r--activerecord/lib/active_record/associations/builder/belongs_to.rb2
-rw-r--r--guides/rails_guides/levenshtein.rb4
-rw-r--r--railties/lib/rails/command/spellchecker.rb4
6 files changed, 10 insertions, 7 deletions
diff --git a/.rubocop.yml b/.rubocop.yml
index f2aec3f430..a673e6ba83 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -176,6 +176,9 @@ Lint/StringConversionInInterpolation:
Lint/UriEscapeUnescape:
Enabled: true
+Style/ParenthesesAroundCondition:
+ Enabled: true
+
Style/RedundantReturn:
Enabled: true
AllowMultipleReturnValues: true
diff --git a/actionview/lib/action_view/helpers/text_helper.rb b/actionview/lib/action_view/helpers/text_helper.rb
index 77a1c1fed9..a338d076e4 100644
--- a/actionview/lib/action_view/helpers/text_helper.rb
+++ b/actionview/lib/action_view/helpers/text_helper.rb
@@ -228,7 +228,7 @@ module ActionView
# pluralize(2, 'Person', locale: :de)
# # => 2 Personen
def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)
- word = if (count == 1 || count =~ /^1(\.0+)?$/)
+ word = if count == 1 || count =~ /^1(\.0+)?$/
singular
else
plural || singular.pluralize(locale)
diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb
index 45edfe18be..4d47706bda 100644
--- a/actionview/test/template/text_helper_test.rb
+++ b/actionview/test/template/text_helper_test.rb
@@ -9,7 +9,7 @@ class TextHelperTest < ActionView::TestCase
super
# This simulates the fact that instance variables are reset every time
# a view is rendered. The cycle helper depends on this behavior.
- @_cycles = nil if (defined? @_cycles)
+ @_cycles = nil if defined?(@_cycles)
end
def test_concat
diff --git a/activerecord/lib/active_record/associations/builder/belongs_to.rb b/activerecord/lib/active_record/associations/builder/belongs_to.rb
index b5fb0092d7..0166ed98ca 100644
--- a/activerecord/lib/active_record/associations/builder/belongs_to.rb
+++ b/activerecord/lib/active_record/associations/builder/belongs_to.rb
@@ -34,7 +34,7 @@ module ActiveRecord::Associations::Builder # :nodoc:
foreign_key = reflection.foreign_key
cache_column = reflection.counter_cache_column
- if (@_after_replace_counter_called ||= false)
+ if @_after_replace_counter_called ||= false
@_after_replace_counter_called = false
elsif association(reflection.name).target_changed?
if reflection.polymorphic?
diff --git a/guides/rails_guides/levenshtein.rb b/guides/rails_guides/levenshtein.rb
index c48af797fa..2213ef754d 100644
--- a/guides/rails_guides/levenshtein.rb
+++ b/guides/rails_guides/levenshtein.rb
@@ -12,8 +12,8 @@ module RailsGuides
n = s.length
m = t.length
- return m if (0 == n)
- return n if (0 == m)
+ return m if 0 == n
+ return n if 0 == m
d = (0..m).to_a
x = nil
diff --git a/railties/lib/rails/command/spellchecker.rb b/railties/lib/rails/command/spellchecker.rb
index 04485097fa..085d5b16df 100644
--- a/railties/lib/rails/command/spellchecker.rb
+++ b/railties/lib/rails/command/spellchecker.rb
@@ -24,8 +24,8 @@ module Rails
n = s.length
m = t.length
- return m if (0 == n)
- return n if (0 == m)
+ return m if 0 == n
+ return n if 0 == m
d = (0..m).to_a
x = nil