Skip to content

Commit

Permalink
allow empty case condition
Browse files Browse the repository at this point in the history
rubocop 0.40.0 から、条件式無し case がひっかかるようになった。

rubocop/rubocop#3019

しかし、条件無し case の方が、elsif が連続するより
可読性が上がることがあるため、許可したい
  • Loading branch information
takkanm committed May 26, 2016
1 parent 741474d commit 7b5f1e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ Metrics/AbcSize:

Style/ExtraSpacing:
Enabled: false

Style/EmptyCaseCondition:
Enabled: false
10 changes: 10 additions & 0 deletions sample/sample.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ def many_arg_method(a, b, c, d, e)
4,
5
)

# 条件無し case
a = 1
b = 2
case
when a == 1 then true
when b == 2 then false
else
raise
end

0 comments on commit 7b5f1e2

Please sign in to comment.