Skip to content

RSpec/InvalidFeatureCategory: Suggest an alternative for typos

What does this MR do and why?

This MR enhances 👮 RSpec/InvalidFeatureCategory to suggest an alternative (via did_you_mean stdlib) for simple typos:

For example:

Inspecting 1 file
C

Offenses:

spec/rubocop/cop/rspec/invalid_feature_category_spec.rb:8:79: C: RSpec/InvalidFeatureCategory: Please use a valid feature category. Did you mean :tooling? See https://docs.gitlab.com/ee/development/feature_categorization/#rspec-examples.
RSpec.describe RuboCop::Cop::RSpec::InvalidFeatureCategory, feature_category: :toolnig do
                                                                              ^^^^^^^^

1 file inspected, 1 offense detected

This helps spotting typos like in !105783 (comment 1264713201).

Screenshots or screen recordings

Did you mean?
Screenshot_from_2023-02-03_17-19-31

How to set up and validate locally

  1. Make a typo in feature_category somewhere in a spec.
  2. Run rubocop spec/rubocop/cop/rspec/invalid_feature_category_spec.rb <file>
  3. Enjoy the suggestion

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