Skip to content

Enhance `rake rubocop:todo:generate` to split TODOs into separate files

Peter Leitzen requested to merge pl-rubocop-todo-directory3 into master

What does this MR do and why?

Use rake rubocop:todo:generate to re-generate all RuboCop TODOs.

Use rake 'rubocop:todo:generate[Cop/Name,...]' to re-generate TODOs for given cop rules.

Previously disabled 👮 TODOs (via Enabled: false) in either .rubocop_todo.yml or .rubocop_todo/**/*.yml remain disabled. See #354328 (comment 861679778)

Refs !82008 (comment 860646789)

What's next?

See Split up .rubocop_todo.yml into .rubocop_todo/*... (#354328 - closed).

How to set up and validate locally

Generating all TODOs

$ rake rubocop:todo:generate

Generating RuboCop TODOs with:
  rubocop --parallel --format RuboCop::Formatter::TodoFormatter

This might take a while...
...

Generating TODOs for specific cops

$ rake 'rubocop:todo:generate[Cop/UserAdmin,Capybara/VisibilityMatcher]'
  rubocop --parallel --format RuboCop::Formatter::TodoFormatter --only Capybara/VisibilityMatcher,Cop/UserAdmin

This might take a while...
Written to .rubocop_todo/capybara/visibility_matcher.yml
Written to .rubocop_todo/cop/user_admin.yml

$ head .rubocop_todo/capybara/visibility_matcher.yml
---
Capybara/VisibilityMatcher:
  # Offense count: 206
  # Temporarily disabled due to too many offenses
  Enabled: false
  Exclude:
    - 'ee/spec/features/billings/billing_plans_spec.rb'
    - 'ee/spec/features/boards/sidebar_spec.rb'
    - 'ee/spec/features/epics/epic_show_spec.rb'
    - 'ee/spec/features/epics/todo_spec.rb'
...
$ head .rubocop_todo/cop/user_admin.yml
---
Cop/UserAdmin:
  Exclude:
    - 'app/controllers/admin/impersonations_controller.rb'
    - 'app/controllers/sessions_controller.rb'
    - 'app/finders/autocomplete/routes_finder.rb'
    - 'app/finders/ci/jobs_finder.rb'
    - 'app/finders/ci/runners_finder.rb'
    - 'app/finders/personal_access_tokens_finder.rb'
    - 'app/finders/users_finder.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. 

* [x] I have evaluated the [MR acceptance checklist](https://docs.gitlab.com/ee/development/code_review.html#acceptance-checklist) for this MR.
Edited by Peter Leitzen

Merge request reports