RuboCop 0.59.1 がリリースされた

RuboCop 0.59.1 がリリースされた。今回はパッチバージョンということで、RuboCop 0.59.0 を使っているユーザーは上げておくのがおすすめ。

github.com

ざっくりと今回の変更履歴の内容を取り上げる。

Bug fixes

#6267: Fix undefined method 'method_name' for Rails/FindEach. (@Knack)

Rails/FindEach cop でエラーが発生する際のバグフィックス

#6278: Fix false positive for Naming/FileName when investigating gemspecs. (@kddeisz)

RuboCop 0.59.0 のバグフィックスで有効になった Naming/FileName へのパッチ。拡張子が .gemspec のファイルのファイル名について取り締まらないようにしている。

#6256: Fix false positive for Naming/FileName when investigating dotfiles. (@sinsoku)

同じく、RuboCop 0.59.0 のバグフィックスで有効になった Naming/FileName へのパッチ。. (ドット) で始まる隠しファイルのファイル名について取り締まらないようにしている。

#6242: Fix Style/EmptyCaseConditionauto-correction removes comment between case and first when. (@koic)

Style/EmptyCaseCondition cop へのパッチ。以下のように最初の when の上にあるコメントが auto-correct で消えるバグを直している。

def foo
  case
  # when bar ...
  when bar
    2
  end
end

#6261: Fix undefined method error for Style/RedundantBegin when calling super with a block. (@eitoball)

Style/RedundantBegin cop について、以下のような super でブロックを使ったコードに対してエラーが起きる問題が直されている。

def a_method
  super do |arg|
    foo
  rescue => e
    bar
  end
end

#6263: Fix an error Layout/EmptyLineAfterGuardClause when guard clause is after heredoc including string interpolation. (@koic)

Layout/EmptyLineAfterGuardClause cop の修正。以下のように式展開を含むヒアドックの後にガード条件があるときにエラーが起きる問題が直されている。

raise(<<-FAIL) unless true
  #{1 + 1}
FAIL
1

#6281: Fix false negative in Style/MultilineMethodSignature. (@drenmi)

Style/MultilineMethodSignature cop で行の長さの計算に起因した偽陰性に関して修正されている。

#6264: Fix an incorrect autocorrect for Layout/EmptyLineAfterGuardClause cop when if condition is after heredoc. (@koic)

Layout/EmptyLineAfterGuardClause cop の修正。ヒアドックが関わる auto-correct した際に Range を求めるための方法が考慮されていなかった不具合と、後置 if への考慮漏れの複数要因で、auto-correct による空行位置が間違っていた不具合が直されている。

Changes

#6272: Make Lint/UnreachableCode detect exit, exit! and abort. (@hoshinotsuyoshi)

Lint/UnreachableCode cop が対象とするメソッドに exit!, exit!, abort が加えられている。

#6295: Exclude#=== from Naming/BinaryOperatorParameterName. (@zverok)

Naming/BinaryOperatorParameterName cop が取り締まらない対象に === を含めている。

Add + to allowed file names of Naming/FileName. (@yensaki)

Naming/FileName への変更。Action Pack Variants のように、some_file.xlsx+mobile.axlsx といった + を含んだファイル名について許容するように変更された。