Skip to content

RSpec/MissingFeatureCategory: Skip highlighting describe block

What does this MR do and why?

Follow-up of !109481 (diffs, comment 1249043366).

Highlighting RSpec.describe ... { } (including block) is disruptive in some editors.

This commit fixes this issue and only highlights the RSpec.describe ... (without the block).

So it's highlighting

RSpec.describe Billing::PlanComponent, :aggregate_failures, type: :component do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

instead of

RSpec.describe Billing::PlanComponent, :aggregate_failures, type: :component do ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Screenshots

After

$ rubocop --only RSpec/MissingFeatureCategory ee/spec/components/billing/plan_component_spec.rb
Inspecting 1 file
C

Offenses:

ee/spec/components/billing/plan_component_spec.rb:4:1: C: RSpec/MissingFeatureCategory: Please add missing feature
category. See https://docs.gitlab.com/ee/development/feature_categorization/#rspec-examples.
RSpec.describe Billing::PlanComponent, :aggregate_failures, type: :component do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

Before

$ rubocop --only RSpec/MissingFeatureCategory ee/spec/components/billing/plan_component_spec.rb
Inspecting 1 file
C

Offenses:

ee/spec/components/billing/plan_component_spec.rb:4:1: C: RSpec/MissingFeatureCategory: Please add missing feature
category. See https://docs.gitlab.com/ee/development/feature_categorization/#rspec-examples.
RSpec.describe Billing::PlanComponent, :aggregate_failures, type: :component do ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 1 offense detected

How to set up and validate locally

export REVEAL_RUBOCOP_TODO=1
bundle exec rubocop --only RSpec/MissingFeatureCategory ee/spec/components/billing/plan_component_spec.rb

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