0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

rubocopのプラグインの呼び出し方が変更されていた

Posted at

はじめに

先日rubocopとその拡張機能であるrubocop-rspecのgemを現在の最新版にアップデートし、rubocopを実行したところ、以下のメッセージが表示されました(rubocopは1.75.1、rubocop-rspecは3.5.0)。

$ rubocop
rubocop-rspec extension supports plugin, specify `plugins: rubocop-rspec` instead of `require: rubocop-rspec` in /xxxxx/.rubocop.yml.

なにこれ?

rubocop 1.72 からプラグインシステムが導入されたそうです。
https://docs.rubocop.org/rubocop/plugin_migration_guide.html

上記のガイドから、その目的をブラウザの日本語翻訳機能で翻訳して抜粋します。

RuboCop 拡張機能の改良された API (プラグインと呼ばれる) が導入され、RuboCop を拡張するための公式に文書化された方法が提供されます。この API はlint_rollerライブラリによって提供され、必要に迫られて登場した以前の文書化されていない非公式の方法を置き換えることを目的としています。

つまり非公式だった拡張機能を公式にしたので、呼び出し方も変えた感じでしょうか。

このメッセージの消し方は?

.rubocop.ymlで拡張機能の呼び出し方を変更すればOK。
というか、requireをpluginsにするだけで簡単。

before

.rubocop.yml
require: rubocop-rspec

after

.rubocop.yml
plugins: rubocop-rspec

※複数の設定が必要なら以下の様な感じ

.rubocop.yml
plugins:
 - rubocop-rspec
 - rubocop-performance

以下も参考になります
https://docs.rubocop.org/rubocop-rspec/usage.html

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?