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

Cop for consistent usage of parens in FactoryBot calls

Open Liberatys opened this issue 5 years ago • 6 comments

Implement a new cop that enables the enforcement of parentheses in factory bot calls.

This cop attempts to solve the "issue" outlined in #416 edit: fixes #416


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.
  • [x] 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:

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

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

  • [ ] Set VersionChanged in config/default.yml to the next major version.

Liberatys avatar Nov 15 '20 16:11 Liberatys

This cop attempts to solve the "issue" outlined in #416

ghost avatar Nov 15 '20 16:11 ghost

RuboCop is red, I hope you'll find it relatively easy to fix it.

pirj avatar Nov 18 '20 16:11 pirj

@Darhazer Sorry for a long time between activities ^^ I pretty much forgot that this pr exists :D. I added your concern about the 'nested' call as a spec: https://github.com/rubocop/rubocop-rspec/pull/1096/files#diff-e694e1d15e68306d0a724e35afadbc5a430fd6602ccd827e985f2aefae2935c7R228.

I also added some specs for multiline calls: https://github.com/rubocop/rubocop-rspec/pull/1096/files#diff-e694e1d15e68306d0a724e35afadbc5a430fd6602ccd827e985f2aefae2935c7R160-R175.

🙏🏻 Thank you for the work on rspec and rubocop.

ghost avatar Apr 20 '22 06:04 ghost

@pirj I rebased onto upstream, regenerated the docs and implement your suggestions ^^ Thank you for the review :D

ghost avatar Apr 20 '22 19:04 ghost

Thank you! Looks great 🙌

pirj avatar Apr 20 '22 21:04 pirj

ah 🤦🏻 @pirj Sorry. Should have checked again if the CI passed :/. Thank you very much for fixing it!

ghost avatar Apr 21 '22 15:04 ghost

Thank you for the contribution, your time and effort, @Liberatys! My apologies for delaying the merge.

pirj avatar Oct 19 '22 21:10 pirj