rubocop-factory_bot
rubocop-factory_bot copied to clipboard
Include `**/factories.rb` in the inspection target
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_pathsattribute. The default load order is:
factories.rbtest/factories.rbtest/factories/**/*.rbspec/factories.rbspec/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.mdif 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: pendinginconfig/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>>"indefault/config.yml.
If you have modified an existing cop's configuration options:
- [ ] Set
VersionChanged: "<<next>>"inconfig/default.yml.