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?

More than 3 years have passed since last update.

[ERROR rubocop] Assignment Branch Condition size for search is too high.

Last updated at Posted at 2021-02-20

bundle exec rubocop したら以下のようなエラーが発生しました。
簡単に和訳すると、コードが長すぎるから短く書き直して!、のようなエラーです。

私の場合、def update ... end までのコードが長すぎるらしい...

Metrics/AbcSize: Assignment Branch Condition size for update is too high. [<6, 23, 2> 23.85/17]
  def update ...

[<6, 23, 2> 23.85/17] が点数を表しています。MAXスコアは 17 なのに 23.85 で長いので、コードを短く書き直せるなら書き直します。
無理な場合は .rubocop.yml に以下を追記します。

rubocop.yml
Metrics/AbcSize:
  Max: 25 

このMaxの部分を 今回は 23.85 で警告が出たので 25 にしました。

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?