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

TrailingComma still registers an offense when it shouldn't #1167

Closed
jfelchner opened this issue Jun 23, 2014 · 2 comments
Closed

TrailingComma still registers an offense when it shouldn't #1167

jfelchner opened this issue Jun 23, 2014 · 2 comments
Assignees
Labels

Comments

@jfelchner
Copy link
Contributor

I noticed a bug from the fix that @jonas054 did in #1075. Unfortunately this is still registering an offense:

scout.throttle!(status:     'realtime',
                over_limit: true)

Even when I have the config set like so:

TrailingComma:
  EnforcedStyleForMultiline: 'comma'

I may be wrong, but it seems like params to a method call may need to be handled differently to just a regular hash since:

scout.throttle! status:     'realtime',
                over_limit: true

Cannot have a trailing ,, even though there's no ) on that last line, otherwise it results in a parse error.

Here's the failing spec to help you out:

    context 'when EnforcedStyleForMultiline is comma' do
      it 'accepts a method call with Hash as last parameter split on multiple lines' do
        inspect_source(cop, ['some_method(a: "b",',
                             '            c: "d")'])
        expect(cop.offenses).to be_empty
      end
    end
@jonas054 jonas054 added the bug label Jun 23, 2014
@jonas054 jonas054 self-assigned this Jun 23, 2014
@jonas054
Copy link
Collaborator

Confirmed. There's a bug in the handling of hash parameters without braces. I'll fix it.

bbatsov added a commit that referenced this issue Jun 23, 2014
[Fix #1167] Fix handling of multi-line parameters in TrailingComma
@jfelchner
Copy link
Contributor Author

@jonas054 you're amazing! ❤️

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

2 participants