SecondBrain/rubocop-todo-exclude-masks-...

1.6 KiB

type title summary tags scope last_updated date source
reference RuboCop: per-cop Exclude lists mask offenses even for explicitly passed paths Why `rubocop <file>` can report "no offenses" on a todo-baselined file that is full of them, and how to verify real cleanliness during a .rubocop_todo.yml burn-down.
type/reference
tool/rubocop
domain/ruby
global 2026-07-10 2026-07-10 credvault

RuboCop: per-cop Exclude masks explicit paths

Passing a file path explicitly to RuboCop does not bypass per-cop Exclude: lists (the kind .rubocop_todo.yml generates). Only AllCops: Exclude globs are bypassed for explicitly named files; --force-exclusion relates to AllCops: Exclude too, not to per-cop excludes.

Consequence: during a todo burn-down, bundle exec rubocop path/to/file.rb reports "no offenses detected" on a baselined file even if it is full of offenses. An agent verifying its refactor this way will falsely conclude the file was already clean and do nothing (this happened on the credvault Sandi Metz burn-down, 2026-07-10).

How to verify real cleanliness

Either:

  1. Lint against a config with the todo stripped:
    grep -v "^inherit_from" .rubocop.yml > /tmp/rubocop-no-todo.yml
    bundle exec rubocop -c /tmp/rubocop-no-todo.yml <files>
    
    (Works when .rubocop.yml's only inherit is the todo; otherwise remove just that entry.)
  2. Or copy the file to a throwaway name not listed in any Exclude and lint the copy.

The definitive end-state check is regenerating the todo (rubocop --regenerate-todo --no-exclude-limit) and confirming it comes out empty.