Repository navigation
feat(hooks): check stale comments at git commit and in Japanese - #253
Merged
Merged
Conversation
The rot-comment hook only saw Write/Edit/MultiEdit, so comments written through Bash never reached it, and its patterns were English-only. Scan the diff a Bash git commit will record, and add Japanese temporal, caller, keep-in-sync and provenance patterns. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…mments Drop the generic phrases (を追加した, 呼び出し元, で使われる, ...) that also appear in legitimate constraint comments. Keep から呼ばれ only after an ASCII identifier and match provenance only as で取得した(実)値. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… check Comments are one line by default in any language. Keep-in-sync instructions belong in a test or check; provenance and decision history belong in the commit message, PR body, or ADR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
概要
陳腐化するコードコメントを止める rot-comment hook が、実際には効いていない場面がありました。この PR で 2 つの原因を塞ぎ、ルールも合わせて補強します。
過去の transcript で、ユーザーが「不要なコードコメントは極力書かなくて良い」と指摘した箇所を調べると、直前に書かれていたコメントは次のようなものでした。
validate_owners.pyのMIGRATION_OPS_TEAMSに足す」gh api …で取得した実値」hook がこれらを素通りした原因は 2 つです。
変更内容
executable_block-rot-comments.pygit commitの実行時にも発火し、commit される diff(git diff --cached。-a/--allのときはgit diff HEAD)に追加されたコメントを検査する。書き込み経路に関係なく捕まえられるcd <dir> &&とgit -C <dir>に対応した。-m "-a"のような値を-aフラグと誤認しないCONSTに足す などsettings.json.tmpl: Bash の PreToolUse にこの hook を登録したdevelopment-principles.md: コメントは言語を問わず既定で 1 行にした。同期指示はテストやチェックで担保し、出所と経緯は commit メッセージ・PR・ADR に書く。hook が拾えるのは一部だけだとも明記した差分の大半はテスト(
tests/hooks/block-rot-comments.test.sh)です。検証
just test→✓ All checks passed!FAIL: commit gate did not block staged rot comment)になり、元に戻すと green になることを確認したchezmoi apply後の実地での発火🤖 Generated with Claude Code