Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Style/WordArray does not report strings with hyphens #7151

Closed
beechtom opened this issue Jun 17, 2019 · 0 comments
Closed

Style/WordArray does not report strings with hyphens #7151

beechtom opened this issue Jun 17, 2019 · 0 comments
Labels
bug good first issue Easy task, suitable for newcomers to the project

Comments

@beechtom
Copy link

Expected behavior

Word arrays with string literals are reported as offenses and rubocop suggests using %w or %W instead.

Actual behavior

Word arrays with string literals are not reported as offenses if any of the strings contain a hyphen.

Steps to reproduce the problem

flags: ACTION_OPTS + ['noop', 'execute', 'compile-concurrency']

With this word array, rubocop does not report any offenses.

flags: ACTION_OPTS + ['noop', 'execute', 'compileconcurrency']

But when removing the hyphen, rubocop does report a syntax offense.

Offenses:

lib/bolt/bolt_option_parser.rb:23:32: C: Style/WordArray: Use %w or %W for an array of words.
        { flags: ACTION_OPTS + ['noop', 'execute', 'compileconcurrency'],
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

RuboCop version

0.71.0

@bbatsov bbatsov added bug good first issue Easy task, suitable for newcomers to the project labels Jun 18, 2019
fwitzke pushed a commit to fwitzke/rubocop that referenced this issue Jun 21, 2019
mvz added a commit to mvz/wait_up that referenced this issue Jun 25, 2019
See rubocop/rubocop#7151 for why this
offense was not previously found.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good first issue Easy task, suitable for newcomers to the project
Projects
None yet
Development

No branches or pull requests

2 participants