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

Sometimes combination of linting fixes with --safe-auto-correct cause syntax errors #7667

Closed
thijsnado opened this issue Jan 24, 2020 · 1 comment

Comments

@thijsnado
Copy link

Expected behavior

Running rubocop --safe-auto-correct shouldn't cause any syntax issues.

Actual behavior

It is possible to cause syntax issues with combinations of auto correct, even when using --safe-auto-correct

Steps to reproduce the problem

given the following config in .rubocop.yml:

# all other rules inherit from default
Style/TrailingCommaInHashLiteral:
  EnforcedStyleForMultiline: consistent_comma

and the following ruby code:

def print_args(*args)
  puts(args)
end

print_args 1, 2, {
  dar: 'car',
}

Running rubocop --safe-auto-correct results in the following code with a syntax error:

def print_args(*args)
  puts(args)
end
print_args 1, 2, 
  dar: 'car',

RuboCop version

0.79.0

@koic
Copy link
Member

koic commented Jan 24, 2020

Thanks for the feedback. Style/BracesAroundHashParameters cop will be removed in the next RuboCop release.
#7641

Please running with Style/BracesAroundHashParameters disabled.

Style/BracesAroundHashParameters:
  Enabled: false

Thank you.

@koic koic closed this as completed Jan 24, 2020
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

2 participants