r7kamura / rspec-json_matcher

RSpec matcher for testing JSON string
MIT License
171 stars 10 forks source link

Style/WordArray-20220513000933 #25

Closed github-actions[bot] closed 2 years ago

github-actions[bot] commented 2 years ago

Rubocop challenge!

Style/WordArray

Safe autocorrect: Yes :white_check_mark: The auto-correct a cop does is safe (equivalent) by design.

Description

Overview

This cop can check for array literals made up of word-like strings, that are not using the %w() syntax.

Alternatively, it can check for uses of the %w() syntax, in projects which do not want to include that syntax.

NOTE: When using the percent style, %w() arrays containing a space will be registered as offenses.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of 3 will not enforce a style on an array of 2 or fewer elements.

Examples

EnforcedStyle: percent (default)

# good
%w[foo bar baz]

# bad
['foo', 'bar', 'baz']

# bad (contains spaces)
%w[foo\ bar baz\ quux]

EnforcedStyle: brackets

# good
['foo', 'bar', 'baz']

# bad
%w[foo bar baz]

# good (contains spaces)
['foo bar', 'baz quux']

Auto generated by rubocop_challenger