Rubocop: False positives on Rails/DynamicFindBy

Created on 1 Dec 2016  路  2Comments  路  Source: rubocop-hq/rubocop

Any method named find_by_* is triggering Rails/DynamicFindBy errors. This is occurring even if the methods are statically defined.

For example any call to this method triggers it:
https://github.com/projecthydra/hydra-head/blob/f63dcc2592fbef6a648ae21e85433db7c2a7749f/hydra-access-controls/lib/hydra/user.rb#L20

Most helpful comment

Hi, thanks for your feedback!
I also recognize the problem.
We can use whitelist for the problem.

e.g.

# In .rubocop.yml
Rails/DynamicFindBy:
  Whitelist:
    - find_by_user_key

https://github.com/bbatsov/rubocop/issues/3455#issuecomment-253237902

All 2 comments

Hi, thanks for your feedback!
I also recognize the problem.
We can use whitelist for the problem.

e.g.

# In .rubocop.yml
Rails/DynamicFindBy:
  Whitelist:
    - find_by_user_key

https://github.com/bbatsov/rubocop/issues/3455#issuecomment-253237902

That's the reason the whitelist exists. There's nothing else we can do (apart from disabling the cop).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aqualon picture Aqualon  路  3Comments

bbatsov picture bbatsov  路  3Comments

mlammers picture mlammers  路  3Comments

deivid-rodriguez picture deivid-rodriguez  路  3Comments

david942j picture david942j  路  3Comments