Just do IT

思うは招く

Rubocopエラー Error: The `Layout/IndentFirstArgument` cop has been renamed to `Layout/FirstArgumentIndentation` を対処

環境

  • Mac/Homebrew
  • rbenv 1.1.2
  • ruby 2.6.5

問題

rubocopを動かそうとした。

bundle exec rubocop

以下のエラーが出た。

Error: The `Layout/IndentFirstArgument` cop has been renamed to `Layout/FirstArgumentIndentation`.
(obsolete configuration found in /Users/<username>/rubybook/.rubocop.yml, please update it)
The `Layout/TrailingBlankLines` cop has been renamed to `Layout/TrailingEmptyLines`.
(obsolete configuration found in /Users/<username>/rubybook/.rubocop.yml, please update it)
The `Lint/StringConversionInInterpolation` cop has been renamed to `Lint/RedundantStringCoercion`.
(obsolete configuration found in /Users/<username>/rubybook/.rubocop.yml, please update it)

<username>部分は書き換えている。

解決

カレントディレクトリではなく、その2つ上の階層に.rubocop.ymlがあり、それが邪魔をしているようだった。 なぜこのディレクトリに.rubocop.ymlを作ったのか覚えておらず、使ってもいないので削除した。

rm .rubocop.yml

これでrubocopが動くようになった。