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/DynamicFindBy issue with Gem::Specification.find_by_name #51

Closed
spaghetticode opened this issue May 9, 2019 · 0 comments · Fixed by #69
Closed

Rails/DynamicFindBy issue with Gem::Specification.find_by_name #51

spaghetticode opened this issue May 9, 2019 · 0 comments · Fixed by #69

Comments

@spaghetticode
Copy link

The analyzer should not complain about Gem::Specification.find_by_name as this is not an ActiveRecord model and so using find_by_name is correct:

Offenses:

spec/features/admin/orders/adding_line_items_spec.rb:5:11: C: Rails/DynamicFindBy: Use find_by instead of dynamic find_by_name.
gem_dir = Gem::Specification.find_by_name("solidus_backend").gem_dir
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

This is an old issue from the original Rubocop repo: rubocop/rubocop#4967

RuboCop version

Include the output of rubocop -V or bundle exec rubocop -V if using Bundler. Here's an example:

$ [bundle exec] rubocop -V
0.68.1 (using Parser 2.6.3.0, running on ruby 2.5.0 x86_64-darwin17)
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Jun 6, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Jun 6, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Jun 17, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Jun 17, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Jul 2, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Jul 2, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Jul 2, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Aug 13, 2019
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Mar 5, 2020
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Mar 6, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Mar 6, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Mar 6, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Apr 19, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Apr 19, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Apr 19, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Apr 19, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Apr 19, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
tejasbubane added a commit to tejasbubane/rubocop-rails that referenced this issue Apr 20, 2020
In `Rails/DynamicFindBy`.

Also use `AllowedReceivers` & `AllowedMethods` instead of `Whitelist`
which will be deprecated soon.

Fixes rubocop#51.
@koic koic closed this as completed in #69 Apr 20, 2020
koic added a commit that referenced this issue Apr 20, 2020
[Fix #51] Add ability to whitelist receiver class names
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

Successfully merging a pull request may close this issue.

1 participant