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

rubocop -a bug: Hash + comment #1899

Closed
dcu opened this issue May 15, 2015 · 4 comments
Closed

rubocop -a bug: Hash + comment #1899

dcu opened this issue May 15, 2015 · 4 comments
Assignees
Labels

Comments

@dcu
Copy link

dcu commented May 15, 2015

The following program:

def foo(opts = {})
  r = opts.merge({
    p1: opts[:a],
    p2: (opts[:b] || opts[:c]) # a comment
  })

  return r
end

converted to:

def foo(opts = {})
  r = opts.merge(    p1: opts[:a],
    p2: (opts[:b] || opts[:c]) # a comment)

  return r
end
@jonas054 jonas054 added the bug label May 16, 2015
@jonas054 jonas054 self-assigned this May 16, 2015
@jonas054
Copy link
Collaborator

I'm considering a generic solution that stops any auto-correct from creating files with syntax errors in them. Is that a good idea or not? Are we hiding bugs if we do it like that?

@dcu
Copy link
Author

dcu commented May 16, 2015

Errors are fine, I mean I found a couple in a large codebase and they were easy to fix .
I reported them to make the feature better and if you hide them you won't get that.

@bbatsov
Copy link
Collaborator

bbatsov commented May 16, 2015

I'm considering a generic solution that stops any auto-correct from creating files with syntax errors in them. Is that a good idea or not? Are we hiding bugs if we do it like that?

We'll probably hide the bugs this way (would you report a ticket for something that's not causing you problems?). I think the current model works just fine - if something's wrong we have to correct it.

@jonas054
Copy link
Collaborator

Good. I'll make a solution for this particular problem only.

bbatsov added a commit that referenced this issue May 17, 2015
[Fix #1899] Mind comments when correcting braced hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants