Skip to content

Fix cop remaining cop offenses for FactoryBot/InlineAssociation

Problem

In !44840 (merged) we've introduced a new 👮 FactoryBot/InlineAssociation to encourage the use of inline associations in FactoryBot discouraging explicit use of create and build.

This MR enabled the 👮 so new offenses are prevented. Current offenses still needs to be fixed. This issue tracks its progress.

Proposed solution

Resolve auto-correctable file by letting RuboCop auto-correct them automatically 🎉

  1. Pick a file from The List below e.g. ee/spec/factories/ci/reports/security/reports.rb
  2. Create a branch (e.g. pl-rubocop-inline-association-security-reports)
  3. Delete the file from .rubocop_manual_todo.yml
  4. Let RuboCop auto-correct the offenses via e.g. bundle exec rubocop --auto-correct --only FactoryBot/InlineAssociation spec/factories ee/spec/factories
  5. Check changes files and adjust if needed
  6. Commit and create a merge request adding Contributes to #267606 and static code analysis label
  7. Tick off the checkbox(es) and add the MR or mention this merge request in this issue
  8. 🎉

The List

The following offenses need to be fixed:

In certain cases we might need to fix related factories or even specs or just disable this 👮. This is fine.

Edited by Peter Leitzen