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

Rails/Validation cannot autocorrect validation methods with parenthesis properly #6800

Closed
robturtle opened this issue Mar 2, 2019 · 1 comment · Fixed by #6807
Closed
Labels

Comments

@robturtle
Copy link

If you have a code like:

validates_presence_of(:user, :address)

The autocorrection of Rails/Validation will generate code with incorrect syntax.

Expected behavior

validates :user, :address, presence: true

Actual behavior

validates(:user, :address), presence: true

Steps to reproduce the problem

  1. inside an ActiveRecord class, insert line validates_presence_of(:user, :address)
  2. call rubocop -a

RuboCop version

$ [bundle exec] rubocop -V
0.65.0 (using Parser 2.5.3.0, running on ruby 2.5.3 x86_64-darwin16)
@koic koic added the bug label Mar 4, 2019
koic added a commit to koic/rubocop that referenced this issue Mar 4, 2019
Fixes rubocop#6800.

This PR fixes an incorrect auto-correct for `Rails/Validation`
when method arguments are enclosed in parentheses.
@koic
Copy link
Member

koic commented Mar 4, 2019

Thanks for the feedback. I opened a PR #6807.

Drenmi added a commit that referenced this issue Mar 7, 2019
…s_validation

[Fix #6800] Fix an incorrect auto-correct for `Rails/Validation`
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.

2 participants