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

SpaceInsideHashLiteralBraces should allow comment after opening brace #957

Closed
sferik opened this issue Apr 4, 2014 · 1 comment
Closed
Assignees

Comments

@sferik
Copy link
Contributor

sferik commented Apr 4, 2014

In #944 (comment), I mentioned that the SpaceBeforeFirstArg cop was generating a false positive offense for the following code:

ActionMailer::Base.smtp_settings = {
  address: 'smtp.sendgrid.net',
  port: '25',
  authentication: :plain,
  user_name: ENV['SENDGRID_USERNAME'],
  password: ENV['SENDGRID_PASSWORD'],
  domain: ENV['SENDGRID_DOMAIN'],
}

I tried disabling that offense as follows:

ActionMailer::Base.smtp_settings = { # rubocop:disable SpaceBeforeFirstArg

This generated a new offense from the SpaceInsideHashLiteralBraces cop:

C: Space inside { detected.

It seems to me that the SpaceInsideHashLiteralBraces cop should allow a comment (with a space before it) after opening brace.

@bbatsov
Copy link
Collaborator

bbatsov commented Apr 4, 2014

Same problem exists for array literals:

a = [ # comment
  1,
  2,
  3
]

bbatsov added a commit that referenced this issue Apr 5, 2014
[Fix #957] Allow space + comment inside ( { and [
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

No branches or pull requests

3 participants