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/TrailingCommaInArrayLiteral vs Style/HashAsLastArrayItem #9939

Closed
zverok opened this issue Jul 19, 2021 · 1 comment · Fixed by #9943
Closed

Style/TrailingCommaInArrayLiteral vs Style/HashAsLastArrayItem #9939

zverok opened this issue Jul 19, 2021 · 1 comment · Fixed by #9943
Labels

Comments

@zverok
Copy link
Contributor

zverok commented Jul 19, 2021

Code:

x = [
  1,
  {
    a: 1,
    b: 2,
  },
]

.rubocop.yml:

Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: comma

Style/TrailingCommaInArrayLiteral:
  EnforcedStyleForMultiline: comma

Style/HashAsLastArrayItem:
  EnforcedStyle: no_braces

Run rubocop -a

Expected behavior

x = [
  1,
  a: 1,
  b: 2,
]

Actual behavior

x = [
  1,
  
    a: 1,
    b: 2,
  ,
]

(Note the two commas at the end. The rest of the formatting is not what I am reporting)

RuboCop version

$ rubocop -V
1.18.3 (using Parser 3.0.1.1, rubocop-ast 1.7.0, running on ruby 2.7.3 x86_64-linux)
@koic koic added the bug label Jul 19, 2021
@martinjaimem
Copy link

Tried to address this in #9943, any feedback would be great 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants