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

Validate whitespace around << #1651

Closed
daviddavis opened this issue Feb 12, 2015 · 6 comments · Fixed by #1654
Closed

Validate whitespace around << #1651

daviddavis opened this issue Feb 12, 2015 · 6 comments · Fixed by #1654

Comments

@daviddavis
Copy link
Contributor

Rubocop seems not to mind this code:

a = []
a                   <<                  '1'

I'd expect SpaceAroundOperators to pick this up.

@bquorning
Copy link
Contributor

This was a surprise to me, too. It seems that Style::SpaceAroundOperators only complains if there are no spaces around the operators, not if there are too many.

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 13, 2015

Pretty sure the reason for this was = and the fact that some people write code like:

ala_bala = 5
x        = 10

I think we should start checking for extra whitespace and just introduce a config option to ignore certain ops.

@bquorning
Copy link
Contributor

That makes sense.

It looks like it's pretty easy to change SpaceAroundOperators to check for too many spaces. Should I try fixing this one?

@bbatsov
Copy link
Collaborator

bbatsov commented Feb 13, 2015

You definitely should! :-)

@daviddavis
Copy link
Contributor Author

👍 @bbatsov and @bquorning

@bquorning
Copy link
Contributor

Proposed fix in #1654.

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

Successfully merging a pull request may close this issue.

3 participants