rubocop-factory_bot icon indicating copy to clipboard operation
rubocop-factory_bot copied to clipboard

Include `**/factories.rb` in the inspection target

Open r7kamura opened this issue 1 year ago • 0 comments

According to the factory_bot documentation, the default FactoryBot.definition_file_paths also includes factories.rb.

The load order is controlled by the FactoryBot.definition_file_paths attribute. The default load order is:

  1. factories.rb
  2. test/factories.rb
  3. test/factories/**/*.rb
  4. spec/factories.rb
  5. spec/factories/**/*.rb
  • https://github.com/thoughtbot/factory_bot/blob/cf3f21fcbbccbc40849c74a84eeb0bb0bd6c7606/docs/src/ref/find_definitions.md?plain=1#L9-L13

Therefore, it would be reasonable to include this file in the inspection target.


Before submitting the PR make sure the following are checked:

  • [x] Feature branch is up-to-date with master (if not - rebase it).
  • [x] Squashed related commits together.
  • [ ] Added tests.
  • [x] Updated documentation.
  • [x] Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • [x] The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

If you have created a new cop:

  • [ ] Added the new cop to config/default.yml.
  • [ ] The cop is configured as Enabled: pending in config/default.yml.
  • [ ] The cop documents examples of good and bad code.
  • [ ] The tests assert both that bad code is reported and that good code is not reported.
  • [ ] Set VersionAdded: "<<next>>" in default/config.yml.

If you have modified an existing cop's configuration options:

  • [ ] Set VersionChanged: "<<next>>" in config/default.yml.

r7kamura avatar Feb 19 '24 10:02 r7kamura