-
-
Notifications
You must be signed in to change notification settings - Fork 2
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/DynamicFindBy の誤検出 #54
Comments
Tokens の Rails/DynamicFindBy:
Whitelist:
- find_by_valid_token https://github.com/rubocop-hq/rubocop-rails/blob/v2.5.2/config/default.yml#L163-L169 なお Capybara の |
Fixes rubocop/rubocop-jp#54 (Ja) This PR fixes a false positive for `Rails/DynamicFindBy` when not inheriting `ApplicationRecord` and without no receiver. A dynamic matcher without receiver is only possible if it inherits `ApplicationRecord` (`ActiveRecord::Base`). For example, Capybara's `find_by_id` and Token's `find_by_valid_token` should be accepted by default. - https://www.rubydoc.info/github/jnicklas/capybara/Capybara/Node/Finders#find_by_id-instance_method - https://github.com/fnando/tokens
rubocop/rubocop-rails#466 にて、レシーバーなしの |
|
rubocop-rails 2.0.1 の Rails/DynamicFindBy で
find_by_id
find_by_valid_token
が誤検出されました。
とりあえず Exclude でファイルごと除外していますが、 tokens gem と似た感じで独自定義の
find_by_なんとか
も引っかかっていたので、許可するメソッド名を指定したいです。find_by_id
の方は ActiveRecord の方は指摘して欲しいので、 capybara を使った spec の方を別の書き方にした方が良いのかもしれないと思いました。The text was updated successfully, but these errors were encountered: