feat(lint): rule⑧ no-docs-relative-back-to-docs (Phase d P-2 / Bundle j-1 / 順位 94)#140
Merged
Merged
Conversation
… preview metrics + post-merge-feedback 結果)
…(../docs/` 検出 (順位 94 / Bundle j-1)
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthrough新しいカスタムリントルール ChangesMD相対リンク検出ルール実装・テスト・ドキュメント更新
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Merged
7 tasks
aloekun
added a commit
that referenced
this pull request
May 11, 2026
…nup (Phase d P-3 繰上げ) (#141) * docs: 順位 101-105 (PR #140 T1-#1/#2/#3 + T3-#1/#2 採用) 登録 + analysis.md P-2 完了反映 (classifier preview metrics + fallback rate 100% trend signal) * docs(todo): 順位 85+86 (Bundle g-1) は PR #125 で land 済を反映 — stale todo entries 削除 + analysis.md P-3 完了反映 * test(custom-lint): rule⑥ no-ephemeral-todo-reference self-exclusion 回帰テスト追加 + analysis.md P-3 完了反映 (順位 68 / Bundle d / Phase d P-3 繰上げ)
This was referenced May 11, 2026
aloekun
added a commit
that referenced
this pull request
May 12, 2026
…1/103/106) (#146) * docs(todo,analysis): post-merge-feedback PR #145 採用 2 件登録 + Phase D D-1 完了反映 PR #145 (D-1) merge 後の post-merge-feedback で採用された 2 件 (Tier 3 #1 + #3) を todo 系列に登録し、analysis.md の Phase D section に D-1 land 状況と副産物を反映する。 順位 116 (Tier 3 XS、PR #145 T3-#1): - ADR-040 step_timeout 説明に sublinear / KV cache locality clarification 追記 - 実測値 600s 採択 / 保守上限 720s / sublinear 性の KV cache 根拠 順位 117 (Tier 3 S、PR #145 T3-#3): - coding-style.md § Cross-File Reference Lifecycle に ephemeral → permanent 知識移管 edit order を追記 - 3 ステップ原則 (① permanent target 先行作成・validate → ② 参照追加 → ③ 参照元削除) analysis.md Phase D section 更新: - D-1 land 状況 (PR #145、298 行、ZERO findings APPROVE) を table の状態列に反映 - 順位 115 を D-2 前 critical path として明示 - D-1 dogfood outcome として 4 項目記録 (skip 理由 / workflow gap 発見 / ADR-040 fix / migration codify) 順位 115 (Tier 1) の rationale に「post-merge-feedback Tier 1 #1 で再 validate 済」を追記。 * feat(hooks-post-tool-linter): D-2 lint rule code touch (順位 101/103/106) Phase D dogfood の 2 本目 (D-2)。lint rule の test gap + struct doc + self-exclusion guards を bundled。 順位 101 (PR #140 T1-#1 採用): rule⑧ depth-1 root MD edge case test 2 件追加 - md_no_docs_relative_detects_root_level_back_reference (CLAUDE.md fixture) - md_no_docs_relative_detects_root_readme_back_reference (README.md fixture) - 「fire = true positive」整理を doc comment と test 名で明示 - root-level MD からの ../docs/ 参照は repo 外を指す broken link で真陽性が正しい挙動 順位 103 (PR #140 T1-#3 採用): CustomRule struct に lint runner field reference doc comment 追加 - サポート field 一覧 (id/pattern/severity/message/extensions/why/fix/example) を /// で記述 - planned field (paths、順位 102) も併記し設計-実装 gap を構造的に予防 - custom-lint-rules.toml 冒頭コメントに main.rs CustomRule struct への動線追加 順位 106 (PR #141 T2-#1 採用): self-exclusion invariant test に 2 false-green guards 追加 - assert!(path.exists()) — deployed TOML 削除 / 移動時の silent pass 抑止 - assert!(extensions contains "toml") — rule scope 変更時の silent degradation 抑止 - 各 assertion message に silent degradation のリスクと由来 (順位 106 / PR #141 T2-#1) を inline で記述 cargo test pass: hooks-post-tool-linter 95 tests (新規 2 + 既存 +1 強化、ZERO regression)。 PR #145 = D-1 と同様、lint_screen dogfood は順位 115 (env var override) land 前のため skip。
aloekun
added a commit
that referenced
this pull request
May 12, 2026
…hase D D-3) PR #140 post-merge-feedback Tier 1 #2 採用。lint runner に glob ベースの paths filter を追加し、path-sensitive な lint rule を explicit filter で表現可能にする。 実装 (src/hooks-post-tool-linter/src/main.rs + Cargo.toml): - globset = 0.4 を依存追加 (BurntSushi 製、ripgrep の依存と同じ) - CustomRule::paths: Option<Vec<String>> field 追加 (optional、既存 rule に影響なし) - CompiledRule に paths_glob: Option<GlobSet> を cache (lint 実行時の repeated compile を回避) - compile_paths_glob() helper: None / Some(empty) → None (filter なし)、glob valid → Some(GlobSet)、invalid → Err (rule drop) - rule_matches_path() helper: paths_glob None なら全 path 受容、Some なら GlobSet match で判定 - Windows-style backslash path も に normalize して match - run_custom_rules で extensions × paths を AND 結合 (両方マッチで rule 対象) - 関数長 50 行制限維持のため build_violation_json / collect_violations_for_rule に切り出し - CustomRule doc comment の planned: paths → supported: paths に更新 unit test 7 件追加: - paths_filter_none_accepts_any_path - paths_filter_empty_vec_accepts_any_path - paths_filter_recursive_glob_matches_docs_only - paths_filter_normalizes_windows_separators - paths_filter_multiple_globs_or_semantics - paths_filter_invalid_glob_drops_rule - run_custom_rules_extensions_and_paths_are_anded (AND 結合 E2E) 意図的保留 (順位 118 として todo 化): - rule⑧ への paths = ["docs/**/*.md"] migration は当初計画していたが、D-2 (順位 101) で追加した root-level MD (CLAUDE.md / README.md) からの ../docs/ fire 挙動が scope narrow で壊れるため保留。trade-off 検討は別 PR に分離。 cargo test pass: hooks-post-tool-linter 102 tests (新規 7 + 既存 95、ZERO regression)。 Phase D D-3: 順位 115 (PR #147) land 後の **初の real lint_screen dogfood**。 LINT_SCREEN_ENABLED=true 経路で push pipeline 経由 lint_screen を実行し、metrics (screen_decision / findings / fallback_reason / Diagnostic section / latency) を観測。
Merged
7 tasks
aloekun
added a commit
that referenced
this pull request
May 12, 2026
…hase D D-3) (#148) PR #140 post-merge-feedback Tier 1 #2 採用。lint runner に glob ベースの paths filter を追加し、path-sensitive な lint rule を explicit filter で表現可能にする。 実装 (src/hooks-post-tool-linter/src/main.rs + Cargo.toml): - globset = 0.4 を依存追加 (BurntSushi 製、ripgrep の依存と同じ) - CustomRule::paths: Option<Vec<String>> field 追加 (optional、既存 rule に影響なし) - CompiledRule に paths_glob: Option<GlobSet> を cache (lint 実行時の repeated compile を回避) - compile_paths_glob() helper: None / Some(empty) → None (filter なし)、glob valid → Some(GlobSet)、invalid → Err (rule drop) - rule_matches_path() helper: paths_glob None なら全 path 受容、Some なら GlobSet match で判定 - Windows-style backslash path も に normalize して match - run_custom_rules で extensions × paths を AND 結合 (両方マッチで rule 対象) - 関数長 50 行制限維持のため build_violation_json / collect_violations_for_rule に切り出し - CustomRule doc comment の planned: paths → supported: paths に更新 unit test 7 件追加: - paths_filter_none_accepts_any_path - paths_filter_empty_vec_accepts_any_path - paths_filter_recursive_glob_matches_docs_only - paths_filter_normalizes_windows_separators - paths_filter_multiple_globs_or_semantics - paths_filter_invalid_glob_drops_rule - run_custom_rules_extensions_and_paths_are_anded (AND 結合 E2E) 意図的保留 (順位 118 として todo 化): - rule⑧ への paths = ["docs/**/*.md"] migration は当初計画していたが、D-2 (順位 101) で追加した root-level MD (CLAUDE.md / README.md) からの ../docs/ fire 挙動が scope narrow で壊れるため保留。trade-off 検討は別 PR に分離。 cargo test pass: hooks-post-tool-linter 102 tests (新規 7 + 既存 95、ZERO regression)。 Phase D D-3: 順位 115 (PR #147) land 後の **初の real lint_screen dogfood**。 LINT_SCREEN_ENABLED=true 経路で push pipeline 経由 lint_screen を実行し、metrics (screen_decision / findings / fallback_reason / Diagnostic section / latency) を観測。
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.
Summary
docs/配下から../docs/への back-link を検出する custom lint rule⑧ (no-docs-relative-back-to-docs) を追加。Phase d roster の P-2 (Bundle j-1 / 順位 94) に該当。(?i)\]\(\.\./docs/regex 1 行で PR docs(todo): split summary and todo5.md tasks to keep files under 50KB #133 と同型の broken link bug class を pre-push で block../<other-dir>/skip / 拡張子限定 (md のみ)変更内容
Commit 1 (前 PR carry-over): 順位 100 登録 + analysis.md P-1 完了反映
PR #139 (Bundle h+g-2) merge 後の post-merge-feedback で採用された Tier 3 #1 (
development-workflow.mdに「同一ファイル複数編集の 1 task 統合」+「partial completion + 後続 PR 追補明記」 の 2 pattern 追補) を 順位 100 としてdocs/todo6.md+docs/todo-summary.mdに登録、analysis.md §4 #2の P-1 行を ✅ 完了化 + dogfood outcome (classifier preview metrics + post-merge-feedback 結果) を記載。本 commit は前 PR からの「フィードバック層」carry-over で、本 PR の P-2 implementation とは独立。
Commit 2: rule⑧ 追加 + linter test + 順位 94 cleanup
.claude/custom-lint-rules.tomlルール⑧
no-docs-relative-back-to-docsを追加 (severity =error):(?i)\]\(\.\./docs/["md"]error自己限定設計:
pathsfilter は lint runner 未実装 (extensionsのみサポート)。pattern semantics で自己限定可:](../docs/は parent-dir 経由でdocs/を再参照する形で、root-level README / docs 外の Markdown では自然な link 形式](docs/...)(相対なし) と区別される。grep 確認で false positive 影響範囲は todo6.md の説明文 1 件のみ (本 PR で削除)。src/hooks-post-tool-linter/src/main.rs5 件の synthetic test:
md_no_docs_relative_detects_pr133_pattern: PR docs(todo): split summary and todo5.md tasks to keep files under 50KB #133 で混入した[ADR-036](../docs/adr/adr-036-...)形式の検出を確認md_no_docs_relative_detects_uppercase_path:../DOCS/...大文字バリアント (case-insensitive) の検出md_no_docs_relative_skips_same_directory_link: 同階層[text](adr/foo.md)(相対参照なし) は skipmd_no_docs_relative_skips_parent_to_other_dir:../README.md/../src/main.rs等 docs 以外への parent-dir 参照は skipmd_no_docs_relative_only_targets_md:.toml等の他拡張子は対象外 (extensions = ["md"] 確認)全 87 test pass、新規 5 test 含む。
todo cleanup
docs/todo6.md: 順位 94 (docs/内 Markdown の../docs/相対パストラップ検出 lint rule) 詳細削除docs/todo-summary.md: priority table から 順位 94 行削除、Bundle j 解説で j-1 land 済を明記Phase d P-2 dogfood signal (classifier preview のみ、real pipeline 未実行)
P-1 と同じ方針 (
feedback_global_config_backupを踏まえた commit pollution 回避):human_review(fallback)human_review(fallback)screen_decision観測:
num_ctxoverflow detection) の必要性が再々確認、P-3 着手前の優先実装を推奨real pipeline 経由の P-2 metric は未取得。P-3 移行時に再判断。
Test plan
cargo test -p hooks-post-tool-linter— 87/87 pass (新規 5 test 含む)pnpm deploy:hooksでビルド・デプロイ確認Out of scope
pathsfilter の lint runner 実装: 現状extensionsのみ。多数の false positive 観測時は別 PR で実装検討num_ctxoverflow detection): P-2 fallback で再確認したが本 PR scope 外、別 PR で実施docs/構造確認が必要、別タイミングで実施Summary by CodeRabbit
リリースノート
New Features
Documentation
Tests