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

space inside hash values #3103

Closed
guyisra opened this issue May 3, 2016 · 1 comment
Closed

space inside hash values #3103

guyisra opened this issue May 3, 2016 · 1 comment

Comments

@guyisra
Copy link

guyisra commented May 3, 2016

on this kind of hash

{a:   1, b: 2}

running rubocop 0.39 on it gives

test.rb:1:1: C: Space inside { missing.
{a:   1, b: 2}
^
test.rb:1:14: C: Space inside } missing.
{a:   1, b: 2}
             ^
test.rb:1:15: C: Final newline missing.
{a:   1, b: 2}

but it won't warn about the space between the a symbol and the 1 key

doing it on

{
  a:   1,
  b: 2
}

does warn about it

test.rb:2:3: C: Align the elements of a hash literal if they span more than one line.
  a:   1,
  ^^^^^^
@jonas054
Copy link
Collaborator

jonas054 commented May 6, 2016

Yes, ExtraSpacing ignores the spacing between keys and values in a hash literal, expecting AlignHash to do that checking. I guess it could be smarter about what AlignHash will not inspect, such as single line hash literals.

tcdowney added a commit to tcdowney/rubocop that referenced this issue Oct 2, 2016
…h literals

Cop was not creating offenses for extra spaces found within single line
hash literals since it  was assuming that Style/AlignHash would
catch any spacing issues.
@bbatsov bbatsov closed this as completed in d78e1c2 Oct 2, 2016
sinsoku added a commit to grooves/forkwell_cop that referenced this issue Oct 14, 2016
sinsoku added a commit to grooves/forkwell_cop that referenced this issue Oct 14, 2016
Neodelf pushed a commit to Neodelf/rubocop that referenced this issue Oct 15, 2016
…h literals

Cop was not creating offenses for extra spaces found within single line
hash literals since it  was assuming that Style/AlignHash would
catch any spacing issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants