Skip to content

Split up .rubocop_todo.yml into .rubocop_todo/**/*.yml

Problem

RuboCop's TODOs .rubocop_todo.yml is huge and contains (almost) all offenses which need to be fixed.

In !72791 (merged) we've started splitting TODOs into .rubocop_todo/**/*.yml. One file per cop 👮. This allowed us to get rid of .rubocop_manual_todo.yml. See Clarify the usage of RuboCop's generated and ma... (#294273 - closed)

In #354328 (closed) we've added the ability to rake rubocop:todo:generate creating TODOs in .rubocop_todo/.

Proposed solution

Split .rubocop_todo.yml into .rubocop_todo/**/*.yml with one file cop 👮.

  1. Pick a 👮 offense from the list below. For example, Gitlab/PolicyRuleBoolean.
  2. Create a well-named branch 354328-rubocop-todo-move-<Cop/Name>.
    • For example, 354328-rubocop-todo-move-Gitlab/PolicyRuleBoolean
      • Hint: Prefixing a branch name with an issue ID (354328) will add required labels and references to this issue in the new merge request.
  3. Generate a TODO file for this cop via rake 'rubocop:todo:generate[<Cop/Name>]' first.
    • For example, rake 'rubocop:todo:generate[Gitlab/PolicyRuleBolean]'
  4. Delete the rule from .rubocop_todo.yml afterwards.
    • It's important to remove the rule only after running rake command above so disabled rules are kept disabled.
    • In MR it can be discussed to re-enable them again.
  5. Commit changes for both .rubocop_todo.yml and .rubocop_todo/<cop>/<name>.yml files.
  6. Create a merge request
  7. Mention this merge request next to the cop offense in the list below.
  8. 🎉

List

Disabled cop rules

Some cop rules have been disabled (via Enabled: false) in .rubocop_todo.yml because they exceeded the amount of allowed offenses (15).

When moving cop rule exclusions from .rubocop_todo.yml into .rubocop_todo/**/*.yml they remain disabled.

Non-controversial rules (e.g. amount of offenses is not too high) can be enabled immediately.

Rules with a huge amount of offenses, for example, Layout/ArgumentAlignment or Layout/HashAlignment require further discussion in the MR which moves the exclusions to .rubocop_todo/.

See #354328 (comment 870464004) for more info!

Edited by Peter Leitzen