RSpec/FeatureCategory: Refrain from marking the whole block
What does this MR do and why?
When feature_category
is missing RuboCop set the whole
RSpec.describe
as offended node which made some IDEs like RubyMine
highlight the complete file making it hard to read.
This MR ensures that only RSpec.describe ...
(without do
) is marked
making the offenses easier on the eyes.
References
Slack (internal)
btw the feature catagory cop is annoying when using in rubymine as it highlights the whole file making it hard to see anything
yeah, i actually suggested they fix one of the files because it made the other rubocop thing impossible to see in rubymine
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Before
$ REVEAL_RUBOCOP_TODO=1 be rubocop --only RSpec/FeatureCategory ee/spec/controllers/admin/application_settings_controller_spec.rb
Inspecting 1 file
C
Offenses:
ee/spec/controllers/admin/application_settings_controller_spec.rb:5:1: C: RSpec/FeatureCategory: Please use a valid feature category. See https://docs.gitlab.com/ee/development/feature_categorization/#rspec-examples
RSpec.describe Admin::ApplicationSettingsController do ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 file inspected, 1 offense detected
After
$ REVEAL_RUBOCOP_TODO=1 be rubocop --only RSpec/FeatureCategory ee/spec/controllers/admin/application_settings_controller_spec.rb
Inspecting 1 file
C
Offenses:
ee/spec/controllers/admin/application_settings_controller_spec.rb:5:1: C: RSpec/FeatureCategory: Please use a valid feature category. See https://docs.gitlab.com/ee/development/feature_categorization/#rspec-examples
RSpec.describe Admin::ApplicationSettingsController do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1 file inspected, 1 offense detected
Note the diff of:
RSpec.describe Admin::ApplicationSettingsController do
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
How to set up and validate locally
REVEAL_RUBOCOP_TODO=1 bundle exec rubocop --only RSpec/FeatureCategory ee/spec/controllers/admin/application_settings_controller_spec.rb