Skip to content

Add descriptions to Rspec cops to fix InternalAffairs/CopDescriptionWithExample

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

In !191481 (merged) we enabled the InternalAffairs/CopDescriptionWithExample cop which requires our RuboCop rules to have a description along with good and bad examples.

We should add descriptions to the existing cops that don't have a valid description. This issue is to fix a subset of those cops.

Not all cops need to be fixed in 1 MR, feel free to fix as many as you want, and we can follow up with the remaining ones in a future MR.

Implementation Plan

  • For each of the following files, understand the cop purpose by looking at the specs and code, as well as the MR it was introduced in, and write a description, as well as good and bad examples:
    • 'rubocop/cop/rspec/expect_gitlab_tracking.rb'
    • 'rubocop/cop/rspec/factories_in_migration_specs.rb'
    • 'rubocop/cop/rspec/factory_bot/avoid_create.rb'
    • 'rubocop/cop/rspec/factory_bot/inline_association.rb'
    • 'rubocop/cop/rspec/factory_bot/strategy_in_callback.rb'
    • 'rubocop/cop/rspec/httparty_basic_auth.rb'
    • 'rubocop/cop/rspec/modify_sidekiq_middleware.rb'
    • 'rubocop/cop/rspec/top_level_describe_path.rb'
    • 'rubocop/cop/rspec/web_mock_enable.rb'
  • Remove the files from .rubocop_todo/internal_affairs/cop_description_with_example.yml
  • Run bundle exec rubocop --only InternalAffairs/CopDescriptionWithExample and ensure there are no errors.
Edited by 🤖 GitLab Bot 🤖