5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【rubocop】こんな警告文がたくさん出た、Please set Enabled to either `true` or `false`

Last updated at Posted at 2020-03-04

rubocopの0.8.1で警告が出た、Please set Enabled to either true or false

このバージョンで新規に追加されたオプションがあると警告が出るようです

今回はこの3つ

- Style/HashEachMethods (0.80)
- Style/HashTransformKeys (0.80)
- Style/HashTransformValues (0.80)

設定ファイルで有効か無効化を選んで指定してくださいと言われてます。

version1まで、この3つのオプションは任意で有効にするか、無効にするかを選べます。
version1になると強制的に有効になるので、今のうちから true にしておくのが良いでしょう。

The following cops were added to RuboCop, but are not configured. Please set Enabled to either `true` or `false` in your `.rubocop.yml` file:
 - Style/HashEachMethods (0.80)
 - Style/HashTransformKeys (0.80)
 - Style/HashTransformValues (0.80)
For more information: https://docs.rubocop.org/en/latest/versioning/

修正方法

警告文にある通り、設定ファイルにこのオプションを利用するかどうか明記しましょう
そして怒られたら、直しましょう。

rubocop.yml
# For rubocop < 1.0.0
Style/HashEachMethods:
  Enabled: true

# For rubocop < 1.0.0
Style/HashTransformKeys:
  Enabled: true

# For rubocop < 1.0.0
Style/HashTransformValues:
  Enabled: true
5
5
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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?