Skip to content

Commit

Permalink
Add examples for 2d arrays to Style/WordArray cop
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima authored and bbatsov committed Dec 31, 2022
1 parent 636449d commit 7b4adef
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/rubocop/cop/style/word_array.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,25 @@ module Style
# # bad (contains spaces)
# %w[foo\ bar baz\ quux]
#
# # bad
# [
# ['one', 'One'],
# ['two', 'Two']
# ]
#
# # good
# [
# %w[one One],
# %w[two Two]
# ]
#
# # good (2d array containing spaces)
# [
# ['one', 'One'],
# ['two', 'Two'],
# ['forty two', 'Forty Two']
# ]
#
# @example EnforcedStyle: brackets
# # good
# ['foo', 'bar', 'baz']
Expand All @@ -36,6 +55,19 @@ module Style
#
# # good (contains spaces)
# ['foo bar', 'baz quux']
#
# # good
# [
# ['one', 'One'],
# ['two', 'Two']
# ]
#
# # bad
# [
# %w[one One],
# %w[two Two]
# ]
#
class WordArray < Base
include ArrayMinSize
include ArraySyntax
Expand Down

0 comments on commit 7b4adef

Please sign in to comment.