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

Style/QuotedSymbols cop autocorrect breaks when the Style/HashSyntax cop is disabled #9845

Closed
davidenglishmusic opened this issue Jun 2, 2021 · 1 comment · Fixed by #9846
Assignees
Labels

Comments

@davidenglishmusic
Copy link

The Style/QuotedSymbols doesn't probably handle quotation marks when in making a automated correction when the Style/HashSyntax cop is disabled.


Expected behavior

{ :"16:9" => 'widescreen' } should be corrected to { :'16:9' => 'widescreen' }

Actual behavior

Instead it corrects to { '"16:9' => 'widescreen' }

Steps to reproduce the problem

  1. Setup the following cops:
Style/QuotedSymbols:
  Enabled: true
Style/HashSyntax:
  Enabled: false
  1. Add { :"16:9" => 'widescreen' } to a file
  2. Run rubocop -a

RuboCop version

$ rubocop -V
1.16.0 (using Parser 3.0.1.1, rubocop-ast 1.7.0, running on ruby 2.6.6 x86_64-darwin20)
@dvandersluis
Copy link
Member

Thanks @davidenglishmusic -- it wasn't showing up with Style/HashSyntax because cops run alphabetically, so it would convert hashrockets before Style/QuotedSymbols ran. Opened a PR to fix correction for hash rockets.

@koic koic closed this as completed in #9846 Jun 2, 2021
koic added a commit that referenced this issue Jun 2, 2021
[Fix #9845] Fix `Style/QuotedSymbols` for hash-rocket hashes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants