Skip to content

RSpec/MultipleMemoizedHelpers: Move pending offenses into .rubocop_todo/

Peter Leitzen requested to merge pl-rubocop-rspec-multiple_memoized_helpers into master

What does this MR do and why?

This MR moves current offenses for 👮 RSpec/MultipleMemoizedHelpers from .rubocop.yml to .rubocop_todo/. Temporary exclusions should be placed there. It removes the exclusions of spec/migrations/**/*.rb.

It also lowers Max from 28 to 25 to bring it close to 20, 10 and 5 eventually 😅

See prior art: !55211 (merged)

Console output

Before

$ REVEAL_RUBOCOP_TODO=0 be rubocop --show-cops | grep -A 10 RSpec/MultipleMemoizedHelpers
RSpec/MultipleMemoizedHelpers:
  Description: Checks if example groups contain too many `let` and `subject` calls.
  Enabled: true
  AllowSubject: true
  Max: 28
  VersionAdded: '1.43'
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
  Exclude:
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/migrations/**/*.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/background_migration/populate_project_snippet_statistics_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/background_migration/populate_finding_uuid_for_vulnerability_feedback_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/lib/gitlab/background_migration/user_mentions/create_resource_user_mention_spec.rb"

After

RSpec/MultipleMemoizedHelpers:
  Description: Checks if example groups contain too many `let` and `subject` calls.
  Enabled: true
  AllowSubject: true
  Max: 25
  VersionAdded: '1.43'
  StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
  Exclude:
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/background_migration/populate_finding_uuid_for_vulnerability_feedback_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/diff/position_tracer/line_strategy_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/requests/api/ci/runner/jobs_artifacts_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/services/ee/boards/issues/move_service_spec.rb"
  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/services/security/store_report_service_spec.rb"

Diff

--- before	2022-01-31 17:23:32.587446747 +0100
+++ after	2022-01-31 17:23:35.675555531 +0100
@@ -2,12 +2,15 @@
   Description: Checks if example groups contain too many `let` and `subject` calls.
   Enabled: true
   AllowSubject: true
-  Max: 28
+  Max: 25
   VersionAdded: '1.43'
   StyleGuide: https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/MultipleMemoizedHelpers
   Exclude:
-  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/migrations/**/*.rb"
-  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/background_migration/populate_project_snippet_statistics_spec.rb"
   - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/background_migration/populate_finding_uuid_for_vulnerability_feedback_spec.rb"
+  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/background_migration/recalculate_vulnerabilities_occurrences_uuid_spec.rb"
+  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/lib/gitlab/diff/position_tracer/line_strategy_spec.rb"
+  - "/home/peter/devel/gitlab/gdk-ee/gitlab/spec/requests/api/ci/runner/jobs_artifacts_spec.rb"
+  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/lib/ee/gitlab/background_migration/populate_latest_pipeline_ids_spec.rb"
   - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/lib/ee/gitlab/background_migration/populate_uuids_for_security_findings_spec.rb"
-  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/lib/gitlab/background_migration/user_mentions/create_resource_user_mention_spec.rb"
+  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/services/ee/boards/issues/move_service_spec.rb"
+  - "/home/peter/devel/gitlab/gdk-ee/gitlab/ee/spec/services/security/store_report_service_spec.rb"

How to set up and validate locally

REVEAL_RUBOCOP_TODO=1 bundle exec rubocop -p --only RSpec/MultipleMemoizedHelpers spec ee/spec

REVEAL_RUBOCOP_TODO=0 bundle exec rubocop -p --only RSpec/MultipleMemoizedHelpers spec ee/spec

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports

Loading