RuboCop cannot load .rubocop.yml (unrecognized cop) in CI
RuboCop validates .rubocop.yml before running. An unrecognized cop name, a missing required extension gem, or an unresolvable inherit_from makes it error out at config load, so no files are inspected.
What this error means
RuboCop fails with "unrecognized cop or department X found in .rubocop.yml" or "cannot load such file" for a require: extension, and exits without linting.
Error: unrecognized cop or department Rails/TimeZone found in .rubocop.yml
Did you mean `Rails/TimeZone`? (obsolete `require: rubocop-rails` missing)Common causes
A cop from an extension that is not required
Cops like Rails/*, RSpec/*, or Performance/* live in extension gems; without the matching require: (and gem installed), RuboCop does not recognize them.
A renamed cop or a broken inherit_from
A cop renamed across versions, or an inherit_from path that does not exist, makes config loading fail.
How to fix it
Install and require the extension
- Add the extension gem (for example
rubocop-rails) to the Gemfile. - Require it in
.rubocop.ymlunderrequire:(orplugins:). - Run
bundle install, then re-run RuboCop.
# .rubocop.yml
require:
- rubocop-railsFix renamed cops and inherit paths
Update obsolete cop names to their new identifiers and correct any inherit_from paths so the config resolves.
How to prevent it
- Keep extension gems in the Gemfile and required in config.
- Pin RuboCop and its extensions together.
- Run
rubocop --lintconfig-style checks after upgrades.