aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/inflector/inflections.rb
diff options
context:
space:
mode:
authorKoichi ITO <koic.ito@gmail.com>2018-01-18 12:09:16 +0900
committerKoichi ITO <koic.ito@gmail.com>2018-01-18 17:19:13 +0900
commit5ac6ec54a673e493cddf6bf2eff5b98e52b3c268 (patch)
tree1a11a6b248c977ccb1a6c0db46cc69625a04ea51 /activesupport/lib/active_support/inflector/inflections.rb
parentffd9902b4464719bd92d49db709d1cf8865337e3 (diff)
downloadrails-5ac6ec54a673e493cddf6bf2eff5b98e52b3c268.tar.gz
rails-5ac6ec54a673e493cddf6bf2eff5b98e52b3c268.tar.bz2
rails-5ac6ec54a673e493cddf6bf2eff5b98e52b3c268.zip
Enable autocorrect for `Lint/EndAlignment` cop
### Summary This PR changes .rubocop.yml. Regarding the code using `if ... else ... end`, I think the coding style that Rails expects is as follows. ```ruby var = if cond a else b end ``` However, the current .rubocop.yml setting does not offense for the following code. ```ruby var = if cond a else b end ``` I think that the above code expects offense to be warned. Moreover, the layout by autocorrect is unnatural. ```ruby var = if cond a else b end ``` This PR adds a setting to .rubocop.yml to make an offense warning and autocorrect as expected by the coding style. And this change also fixes `case ... when ... end` together. Also this PR itself is an example that arranges the layout using `rubocop -a`. ### Other Information Autocorrect of `Lint/EndAlignment` cop is `false` by default. https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443 This PR changes this value to `true`. Also this PR has changed it together as it is necessary to enable `Layout/ElseAlignment` cop to make this behavior.
Diffstat (limited to 'activesupport/lib/active_support/inflector/inflections.rb')
-rw-r--r--activesupport/lib/active_support/inflector/inflections.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb
index 0450a4be4c..7e5dff1d6d 100644
--- a/activesupport/lib/active_support/inflector/inflections.rb
+++ b/activesupport/lib/active_support/inflector/inflections.rb
@@ -227,7 +227,7 @@ module ActiveSupport
case scope
when :all
@plurals, @singulars, @uncountables, @humans = [], [], Uncountables.new, []
- else
+ else
instance_variable_set "@#{scope}", []
end
end