happiness (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) (^_^) happiness

overcommitのrubcopが失敗するとき(Unexpected ouput)

状況

$ git commit

Unexpected output: unable to determine line number or type of error/warning for output:

原因

budle exec の書き方がだめそう。

before

PreCommit:
  RuboCop:
    enabled: true
    command: ['bundle exec rubocop', '--auto-correct', '$(git diff master --name-only)']

これもだめだった

PreCommit:
  RuboCop:
    enabled: true
    command: ['rubocop', '--auto-correct', '$(git diff master --name-only)']

after

PreCommit:
  RuboCop:
    enabled: true
    command: ['bundle', 'exec', 'rubocop', '--auto-correct', '$(git diff master --name-only)']

その他

原因の深追いは今回はしない。

おそらく、localとsystemのrubocop云々と、まとめて書いちゃだめ云々だと思う。

参考 overcommitでgitのhookを設定した - ほたてメモ