Skip to content

Add new cop RSpec/MisspelledAggregateFailures

Peter Leitzen requested to merge pl-rubocop-misspelled-aggregate-failures into master

What does this MR do and why?

This MR adds a new 👮 rule RSpec/MisspelledAggregateFailures to fix misspelled variations of RSpec's :aggregate_failures.

This MR also fixes all existing offenses and puts this cop in "grace period" to avoid broken master.

Closes #396356 (closed).

Offenses

Click to expand
Inspecting 14545 files

Offenses:

spec/lib/api/github/entities_spec.rb:15:13: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    specify :aggregate_failure do
            ^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:336:58: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
            it 'executes only on secondary redis store', :aggregate_errors do
                                                         ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:345:56: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
            it 'executes only on primary redis store', :aggregate_errors do
                                                       ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:440:56: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it "#{store} redis store contains correct values", :aggregate_errors do
                                                       ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:533:68: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
          it 'executes on both primary and secondary redis store', :aggregate_errors do
                                                                   ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:554:58: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
            it 'executes only on secondary redis store', :aggregate_errors do
                                                         ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:563:56: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
            it 'executes only on primary redis store', :aggregate_errors do
                                                       ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:578:70: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
          it 'logs the exception and execute on secondary instance', :aggregate_errors do
                                                                     ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:596:58: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
          it 'is executed only 1 time on each instance', :aggregate_errors do
                                                         ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:648:66: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'executes on both primary and secondary redis store', :aggregate_errors do
                                                                 ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:665:68: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'logs the exception and execute on secondary instance', :aggregate_errors do
                                                                   ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:763:45: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
          it 'executes on secondary store', :aggregate_errors do
                                            ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:772:43: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
          it 'executes on primary store', :aggregate_errors do
                                          ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:933:65: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'fallback and executes only on the secondary store', :aggregate_errors do
                                                                ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:958:65: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'fallback and executes only on the secondary store', :aggregate_errors do
                                                                ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:971:65: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'fallback and executes only on the secondary store', :aggregate_errors do
                                                                ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:984:56: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'is executed only 1 time on each instance', :aggregate_errors do
                                                       ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb:312:38: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'logs the database time', :aggregate_errors do
                                     ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/sidekiq_logging/structured_logger_spec.rb:321:67: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
        it 'prevents database time from leaking to the next job', :aggregate_errors do
                                                                  ^^^^^^^^^^^^^^^^^
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb:434:44: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'calculates union of given events', :aggregate_failure do
                                           ^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/usage_data_counters/hll_redis_counter_spec.rb:439:86: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'validates and raise exception if events has mismatched slot or aggregation', :aggregate_failure do
                                                                                     ^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/usage_data_spec.rb:1070:41: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'records error and returns nil', :aggregated_errors do
                                        ^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/utils/measuring_spec.rb:20:34: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'measures and logs data', :aggregate_failure do
                                 ^^^^^^^^^^^^^^^^^^
spec/migrations/schedule_recalculate_vulnerability_finding_signatures_for_findings_spec.rb:56:49: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'does not schedule the background jobs', :aggregate_failure do
                                                ^^^^^^^^^^^^^^^^^^
spec/requests/api/graphql/jobs_query_spec.rb:17:39: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'has full access to all jobs', :aggregate_failure do
                                      ^^^^^^^^^^^^^^^^^^
spec/requests/api/graphql/jobs_query_spec.rb:28:31: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      it 'gets pending jobs', :aggregate_failure do
                              ^^^^^^^^^^^^^^^^^^
spec/requests/api/graphql/jobs_query_spec.rb:35:42: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      it 'gets pending and failed jobs', :aggregate_failure do
                                         ^^^^^^^^^^^^^^^^^^
spec/requests/api/graphql/jobs_query_spec.rb:48:37: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'has no access to the jobs', :aggregate_failure do
                                    ^^^^^^^^^^^^^^^^^^
spec/requests/api/graphql/mutations/ci/job_play_spec.rb:66:47: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'provides those variables to the job', :aggregated_errors do
                                              ^^^^^^^^^^^^^^^^^^
spec/requests/api/projects_spec.rb:1726:65: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    context 'and using an admin to search', :enable_admin_mode, :aggregate_errors do
                                                                ^^^^^^^^^^^^^^^^^
spec/requests/api/search_spec.rb:144:60: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    context 'when DB timeouts occur from global searches', :aggregate_errors do
                                                           ^^^^^^^^^^^^^^^^^
spec/requests/api/tags_spec.rb:181:46: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    context 'with keyset pagination option', :aggregate_errors do
                                             ^^^^^^^^^^^^^^^^^
spec/services/work_items/widgets/hierarchy_service/update_service_spec.rb:124:62: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
          it 'returns success status if parent not present', :aggregate_failure do
                                                             ^^^^^^^^^^^^^^^^^^
spec/support_specs/matchers/event_store_spec.rb:8:40: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
RSpec.describe 'event store matchers', :aggregate_errors do
                                       ^^^^^^^^^^^^^^^^^
spec/workers/concerns/cronjob_queue_spec.rb:47:75: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
  it 'automatically clears project, user and namespace from the context', :aggregate_failues do
                                                                          ^^^^^^^^^^^^^^^^^^
ee/spec/lib/audit/changes_spec.rb:62:57: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      it 'creates audit event with correct attributes', :aggregate_failure do
                                                        ^^^^^^^^^^^^^^^^^^
ee/spec/lib/bulk_imports/groups/pipelines/iterations_cadences_pipeline_spec.rb:52:38: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'imports iteration cadences', :aggregated_failures do
                                     ^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/bulk_imports/groups/pipelines/iterations_cadences_pipeline_spec.rb:63:46: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    it 'imports iterations within cadences', :aggregated_failures do
                                             ^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/ee/gitlab/import_export/group/tree_restorer_spec.rb:96:36: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    context 'iteration candences', :aggregated_failures do
                                   ^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/ee/gitlab/import_export/group/tree_saver_spec.rb:221:54: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      it 'saves iteration cadences with iterations', :aggregated_failures do
                                                     ^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/ee/gitlab/import_export/repo_restorer_spec.rb:42:44: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      it 'restores the repo successfully', :aggregated_failures do
                                           ^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/ee/gitlab/import_export/repo_restorer_spec.rb:57:49: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    context 'when no group wiki in the bundle', :aggregated_failures do
                                                ^^^^^^^^^^^^^^^^^^^^
ee/spec/lib/gitlab/graphql/aggregations/epics/epic_node_spec.rb:49:39: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      context 'with no child issues', :aggregate_results do
                                      ^^^^^^^^^^^^^^^^^^
ee/spec/lib/gitlab/graphql/aggregations/epics/epic_node_spec.rb:65:46: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      context 'with an issue with 0 weight', :aggregate_results do
                                             ^^^^^^^^^^^^^^^^^^
ee/spec/models/ee/group_spec.rb:2312:35: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
  describe '#repository_storage', :aggregated_failures do
                                  ^^^^^^^^^^^^^^^^^^^^
ee/spec/requests/api/graphql/project/code_coverage_summary_spec.rb:43:49: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
      it 'contains code coverage summary data', :aggregates_failures do
                                                ^^^^^^^^^^^^^^^^^^^^

14545 files inspected, 46 offenses detected, 46 offenses autocorrectable

14545 files inspected, 46 offenses detected, 46 offenses autocorrectable

Screenshots or screen recordings

Screenshot_from_2023-03-15_21-38-43

spec/lib/api/github/entities_spec.rb:15:13: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
    specify :aggregate_failure do
            ^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/redis/multi_store_spec.rb:336:58: C: [Correctable] RSpec/MisspelledAggregateFailures: Use :aggregate_failures to aggregate failures.
            it 'executes only on secondary redis store', :aggregate_errors do
                                                         ^^^^^^^^^^^^^^^^^

How to set up and validate locally

bundle exec rubocop --only RSpec/MisspelledAggregateFailures 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