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/MultilineWhenThen detection failure #8158

Closed
marcandre opened this issue Jun 16, 2020 · 0 comments · Fixed by #8571
Closed

Style/MultilineWhenThen detection failure #8158

marcandre opened this issue Jun 16, 2020 · 0 comments · Fixed by #8571
Labels
bug good first issue Easy task, suitable for newcomers to the project help wanted

Comments

@marcandre
Copy link
Contributor

The following:

# in lib/rubocop/ast/node_pattern.rb

         def compile_arg(token)
           case token
           when WILDCARD  then
             name = token[1..-1]
             access_unify(name) || fail_due_to('invalid in arglist: ' + token)
           when LITERAL   then token
          # ...

does not generate an offense (it should). I realized that as I refactored it as:

         def compile_arg(token)
           name = token[1..-1]
           case token
           when WILDCARD  then
             access_unify(name) || fail_due_to('invalid in arglist: ' + token)
           when LITERAL   then token
          # ...

which generates an offense (correct):

lib/rubocop/ast/node_pattern.rb:656:26: C: [Corrected] Style/MultilineWhenThen: Do not use then for multiline when statement.
          when WILDCARD  then
                         ^^^^
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 help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant