1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

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

View file

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

View file

@ -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)

View file

@ -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

View file

@ -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?

View file

@ -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

View file

@ -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