Enable Style/ParenthesesAroundCondition cop

To prevent style check in review like https://github.com/rails/rails/pull/33608#discussion_r211087605.
This commit is contained in:
Ryuta Kamizono 2018-08-19 08:12:05 +09:00
parent 9270c6d7fc
commit b2c1e29c14
6 changed files with 10 additions and 7 deletions

@ -176,6 +176,9 @@ Lint/StringConversionInInterpolation:
Lint/UriEscapeUnescape:
Enabled: true
Style/ParenthesesAroundCondition:
Enabled: true
Style/RedundantReturn:
Enabled: true
AllowMultipleReturnValues: true

@ -228,7 +228,7 @@ def excerpt(text, phrase, options = {})
# 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)

@ -9,7 +9,7 @@ def setup
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

@ -34,7 +34,7 @@ def belongs_to_counter_cache_after_update(reflection)
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?

@ -12,8 +12,8 @@ def self.distance(str1, str2)
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

@ -24,8 +24,8 @@ def levenshtein_distance(str1, str2) # :doc:
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