Skip to content

Move exclusions for RSpec/LeakyConstantDeclaration to .rubocop_todo

What does this MR do and why?

This MR moves exclusions for 👮 RuboCop rule RSpec/LeakyConstantDeclaration from .rubocop.yml to .rubocop_todo/ so revealing RuboCop TODOs via REVEAL_RUBOCOP_TODO=1 expose those offense correctly.

Contributes to #211580.

How to set up and validate locally

With REVEAL_RUBOCOP_TODO=1

$ REVEAL_RUBOCOP_TODO=1 bundle exec rubocop --only RSpec/LeakyConstantDeclaration spec/db/schema_spec.rb spec/lib/g
itlab/config/entry/simplifiable_spec.rb spec/lib/gitlab/quick_actions/dsl_spec.rb spec/lib/marginalia_spec.rb spec/
mailers/notify_spec.rb spec/models/concerns/batch_destroy_dependent_associations_spec.rb spec/models/concerns/bulk_
insert_safe_spec.rb spec/models/concerns/bulk_insertable_associations_spec.rb spec/models/concerns/triggerable_hook
s_spec.rb spec/models/repository_spec.rb spec/services/clusters/applications/check_installation_progress_service_sp
ec.rb spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb
Inspecting 12 files
CCCCCCCCCCCC

Offenses:

spec/db/schema_spec.rb:15:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  IGNORED_FK_COLUMNS = { ...
  ^^^^^^^^^^^^^^^^^^^^^^
spec/db/schema_spec.rb:146:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  IGNORED_LIMIT_ENUMS = { ...
  ^^^^^^^^^^^^^^^^^^^^^^^
spec/db/schema_spec.rb:193:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  IGNORED_JSONB_COLUMNS = { ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/config/entry/simplifiable_spec.rb:27:7: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
      entry::Something = first
      ^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/config/entry/simplifiable_spec.rb:28:7: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
      entry::DifferentOne = second
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/config/entry/simplifiable_spec.rb:29:7: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
      entry::UnknownStrategy = unknown
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/gitlab/quick_actions/dsl_spec.rb:7:5: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
    DummyClass = Struct.new(:project) do ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/marginalia_spec.rb:6:3: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
  class MarginaliaTestController < ApplicationController ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/marginalia_spec.rb:21:3: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
  class MarginaliaTestJob ...
  ^^^^^^^^^^^^^^^^^^^^^^^
spec/lib/marginalia_spec.rb:31:3: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
  class MarginaliaTestMailer < ApplicationMailer ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/mailers/notify_spec.rb:523:9: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
        class TopLevelThing ...
        ^^^^^^^^^^^^^^^^^^^
spec/mailers/notify_spec.rb:546:9: C: RSpec/LeakyConstantDeclaration: Stub module constant instead of declaring explicitly.
        module Namespaced ...
        ^^^^^^^^^^^^^^^^^
spec/mailers/notify_spec.rb:547:11: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
          class Thing ...
          ^^^^^^^^^^^
spec/models/concerns/batch_destroy_dependent_associations_spec.rb:6:3: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
  class TestProject < ActiveRecord::Base ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/concerns/bulk_insert_safe_spec.rb:42:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  BulkInsertParentItem = Class.new(ActiveRecord::Base) do ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/concerns/bulk_insertable_associations_spec.rb:6:3: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
  class BulkFoo < ApplicationRecord ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/concerns/bulk_insertable_associations_spec.rb:14:3: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
  class BulkBar < ApplicationRecord ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/concerns/bulk_insertable_associations_spec.rb:20:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  SimpleBar = Class.new(ApplicationRecord) do ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/concerns/bulk_insertable_associations_spec.rb:24:3: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
  class BulkParent < ApplicationRecord ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/concerns/triggerable_hooks_spec.rb:7:5: C: RSpec/LeakyConstantDeclaration: Stub class constant instead of declaring explicitly.
    class TestableHook < WebHook ...
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/models/repository_spec.rb:9:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  TestBlob = Struct.new(:path)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/services/clusters/applications/check_installation_progress_service_spec.rb:6:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  RESCHEDULE_PHASES = Gitlab::Kubernetes::Pod::PHASES - [Gitlab::Kubernetes::Pod::SUCCEEDED, Gitlab::Kubernetes::Pod::FAILED].freeze
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb:4:3: C: RSpec/LeakyConstantDeclaration: Stub constant instead of declaring explicitly.
  QuickAction = Struct.new(:action_text, :expectation, :before_action, keyword_init: true) do ...
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

12 files inspected, 23 offenses detected

With

$ REVEAL_RUBOCOP_TODO=0 bundle exec rubocop --only RSpec/LeakyConstantDeclaration spec/db/schema_spec.rb spec/lib/g
itlab/config/entry/simplifiable_spec.rb spec/lib/gitlab/quick_actions/dsl_spec.rb spec/lib/marginalia_spec.rb spec/
mailers/notify_spec.rb spec/models/concerns/batch_destroy_dependent_associations_spec.rb spec/models/concerns/bulk_
insert_safe_spec.rb spec/models/concerns/bulk_insertable_associations_spec.rb spec/models/concerns/triggerable_hook
s_spec.rb spec/models/repository_spec.rb spec/services/clusters/applications/check_installation_progress_service_sp
ec.rb spec/support/shared_examples/quick_actions/issuable/issuable_quick_actions_shared_examples.rb
Inspecting 12 files
............

12 files inspected, no offenses detected

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