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

Trailing comma autocorrected in the wrong place #1349

Closed
strongriley opened this issue Sep 25, 2014 · 2 comments
Closed

Trailing comma autocorrected in the wrong place #1349

strongriley opened this issue Sep 25, 2014 · 2 comments
Assignees

Comments

@strongriley
Copy link

Original:

        expect(subject[:corrected_address]).to eq({
          street1:     "1 Market",
          street2:     "#200",
          city:        "Some Town",
          state:       "CA",
          postal_code: "99999-1111"
        })

Autocorrected:

        expect(subject[:corrected_address]).to eq(street1:     '1 Market',
                                                  street2:     '#200',
                                                  city:        'Some Town',
                                                  state:       'CA',
                                                  postal_code: '99,999-1111                                          ')

Expected:

        expect(subject[:corrected_address]).to eq(street1:     '1 Market',
                                                  street2:     '#200',
                                                  city:        'Some Town',
                                                  state:       'CA',
                                                  postal_code: '99999-1111',)
rubocop -V
0.26.0 (using Parser 2.2.0.pre.4, running on ruby 1.9.3 x86_64-darwin13.3.0)
@yous
Copy link
Contributor

yous commented Oct 1, 2014

This is caused by combination of auto-correction of two cops: Styles/BracesAroundHashParameters and Styles/IndentHash.

expect(subject[:corrected_address]).to eq({
  street1:     '1 Market',
  street2:     '#200',
  city:        'Some Town',
  state:       'CA',
  postal_code: '99999-1111'
})

will be the code below after one Cop::Team#autocorrect call:

expect(subject[:corrected_address]).to eq(                                          street1:     '1 Market',
  street2:     '#200',
  city:        'Some Town',
  state:       'CA',
  postal_code: '99999-1111                                          ')

@jonas054 jonas054 self-assigned this Oct 2, 2014
@jonas054
Copy link
Collaborator

jonas054 commented Oct 2, 2014

Thanks for the information, both of you. I'll try to sort it out.

bbatsov added a commit that referenced this issue Oct 5, 2014
[Fix #1349] Don't change whitespace in BracesAroundHashParameters
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