Rubocopが動かない時

VS Codeの右下に「Rubocopが動かないよ!」という旨のエラーを出すことがある。 対処法を何度も検索しているのでメモしておく。

  1. VSコードが出すコマンドをターミナルで叩いてみる。
$ /Users/xxx/.rbenv/shims/rubocop 
.rubocop_todo.yml: Rails/SelectMap has the wrong namespace - should be Performance
Error: unrecognized cop or department Rails/RedundantActiveRecordAllMethod found in .rubocop_todo.yml
Did you mean `Rails/RedundantAllowNil`?
  1. プロジェクトの.rubocop.ymlを開き、require:以下のrubocopを一通りインストールする
$ gem i rubocop-rails