Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
概要(Overview・Refs Issue)
pre-commit-hookを用いて、php-cs-fixerによるコード整形をcommit時に自動的に適用。
#4624 (comment) 以降を参照
方針(Policy)
実装に関する補足(Appendix)
実行要件
npm install
が行われていること。composer install
が行われていること。php
/node
にPATHが通った状態でcommitが行われること。以上の要件を全て満たした際に、commit時に自動的にコード整形が行われます。
テスト(Test)
この場合pre-commit-hookの呼び出し自体が行われないので確認不要と判断)
再現が難しいことに加え、 確認事項 中 〜を実行できない環境 の対応とあわせ「エラーは全て無視」と実装したため確認不要と判断
参考資料
スクリーンショット添付します。
MacBook Pro (15-inch, 2019) / 1ファイル / 1.4秒
相談(Discussion)
/dev/null へのリダイレクトに相当する処理をクロスプラットフォームで書く方法がよく解らなかったのですごく強引なスクリプトになってしまいました。
環境によって↑のメッセージがcommitの度に表示されるのは回避するためなのですが、
今の書き方はあまり良い方法でない気がします。
他に良い方法ご存知の方がいらしたらアドバイス頂けると助かります。
マイナーバージョン互換性保持のための制限事項チェックリスト
レビュワー確認項目