Repository navigation
feat(lint): migrate rust-style prose rules to checks - #193
Conversation
…clippy Add 11 ast-grep rules and 5 advisory jev-lint model rules for Rust, and delete the prose they or the enabled clippy lints replace. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Review summary (read-only) No P0 or P1 findings. Nothing here blocks the merge. All new ast-grep rules are warning-only. Each rule has Findings, posted inline:
I couldn't run |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cf49845156
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…artly cover Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
レビュー結果ブロッカー(P0/P1)はありません.P3 の改善提案が 3 件あり,インラインコメントに書きました.
ast-grep 規則 11 件,jev-lint 規則 5 件,文章の削除はすべて読みました.新しい規則にはすべて valid / invalid のテストがあります.この環境では ast-grep を実行できなかったため, 🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bf5c61f678
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…public-field struct Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryNo blocking findings (0 × P0/P1). Two non-blocking findings are posted inline:
I read the other 10 ast-grep rules, their rule-tests, the 5 jev-lint rules, and the other prose deletions, and found no correctness problems. Every new ast-grep rule has valid and invalid cases. The jev-lint rules have no fixtures; the PR says that was deliberately deferred and the rules are advisory only. Note: I could not run 🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 47d4fa7253
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…sentence Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryBlocking findings (P0/P1): 0
Other prose deletions look covered. The lints they rely on are default-on or in I read the 11 new ast-grep rules and the 5 jev-lint rules statically. I found no correctness bugs beyond the limits the PR body already lists, and every new ast-grep rule has valid and invalid rule-tests. I could not run 🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: bc376f9318
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…h I/O methods Refs #196 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cd5f4b7bf2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… tests_outside_test_module Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summary (read-only)No blocking findings (0 × P0, 0 × P1). No P2/P3 findings posted. What I checked:
🤖 Generated with Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 225858e193
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ports History: rs_unit_test_in_test_module drew 21 review threads over many rounds and never converged, because ast-grep cannot expand cfg or follow module files. It was removed in favor of clippy tests_outside_test_module (template-rust, separate PR). Prose stays until that lands. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryNo blocking findings (P0: 0, P1: 0). Two P2 comments are inline:
What I checked by reading the code:
What I could not check here:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b47b7e47cb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…clarify follow_links note History: rs_no_path_from_format drew 8 review threads because it parses string contents with a regex (escapes, raw strings, nested calls), so it never converged as a blocking rule. It is now the advisory jev-lint rule paths-are-joined-not-formatted. The follow_links note now points to a reviewed ast-grep-ignore comment for the rare required case. types.md keeps the output-order sentence that clippy iter_over_hash_type does not cover. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryNo blocking findings (0 × P0/P1). No inline comments. What I checked:
Non-blocking note: none of the six new model rules has a fixture or a test that checks which functions it selects. The PR defers this on purpose, so I did not post it as a finding. It should be fixed before any of these rules is promoted from advisory. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66d1f1f5ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66d1f1f5ea
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… and expect Verified with a throwaway crate: allow_attributes_without_reason fires on #[allow] and #[expect] without a reason, and allow_attributes flags #[allow]. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Review summaryNo P0–P3 findings. What I checked:
Limitation: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 709394fa74
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Refs #74 Refs #196 ## 概要 ADR-0021 に「Which rules ast-grep may block」の節を追加し,blocking な ast-grep 規則に求める基準を記録した. - blocking な ast-grep 規則は,1 つの構文要素を局所的に,信頼できる形で判定しなければならない.次のどれかが必要な規則は,言語自身の linter / compiler / test runner(あれば),なければ jev-lint に任せる. 1. ファイル外の情報(設定,`conftest.py`,他のモジュール) 2. データの流れや実行の順番(代入,スコープ,クラス階層) 3. 文法や式を正規表現で解析すること(`cfg(...)`,文字列の中身) 4. 同じ意味の書き方が多いこと(YAML の引用符・flow / block 形式,import の別名) - 根拠として,#192〜#195 のマージ済み PR 本文の「ast-grep から外した規則と理由」の表から,指摘 8 件以上の 12 規則を表にした(規則,指摘数,型,行き先). - `agents/hooks/lint/sgconfig.yml` の先頭に,この節への 1 行の案内をコメントで追加した. - `tests/test_workflow_skill_layout.py`: 追跡されていない `agents/skills/.claude/` が skill として読まれ,環境によって失敗する問題を直した.`.` で始まる名前を `SKILL_NAMES` から除外する(`skill_names()`,先にテストを追加して失敗を確認). ## 補足 - #194 は作成時点で未マージのため,ADR の #194 の 3 行は暫定と明記した(レビュー指摘). - 依頼文では「外した規則は 11〜34 件」とあったが,PR 本文の表には 1〜8 件の規則もある(#193 の Rust など).表には 8 件以上のものだけを載せ,それ未満は「同じ PR 本文に載っており,同じ型に当てはまる」と ADR に書いた.ブロックのまま残った規則は 3 件以下(#194 の Bash / GitHub Actions は 3〜7 件で,見逃しは #196 に送った)と書いている. - 指摘数は各 PR 本文の記載値をそのまま使った(再集計していない). ## 検証 - `uv run pytest tests/test_workflow_skill_layout.py`: 61 件成功(新規テストは,実装前に `NameError` で失敗することを確認). - pre-commit(ruff,ty,shellcheck,commitlint ほか)通過.`dprint fmt` 済み. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <132188853+furedea@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
## 概要 #196 に溜まった指摘を,main に残っている blocking(`severity: error`)の ast-grep 規則に絞って整理し,規則内の局所的な 1 構文の確認で直せるものを直した.#74 の一部. 分類は次のとおり. - **a**:blocking 規則の見逃し・誤検出(規則が main に残っている) - **b**:jev-lint model rule の指摘(保留中の検証用に残す.変更しない) - **c**:obsolete(規則が削除・置換済み) - **d**:hook・文章・インフラ ADR-0021 に入れる基準(#214)は未マージのため,指示された基準をそのまま適用した.局所的な 1 構文(固定名,文字列の接頭辞,ノード種別 1 つの追加)なら規則を直す.ファイル外の情報,データフロー・スコープ,入れ子の文法の正規表現,同義の書き方を追い続ける修正が必要なものは,規則を継ぎ足さない. ## a.blocking 規則(fixture を先に足して修正) | 項目 | 分類 | 対応 | | --------------------------------------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | `go_no_generated_mocks`:`// Code generated by ...` ヘッダーだけの生成 mock | a 修正 | ヘッダーの接頭辞(MockGen / mockery / counterfeiter / moq / minimock)を検出 | | `go_no_context_in_struct`:`*context.Context` のフィールド | a 修正 | `pointer_type` を 1 種類追加 | | `go_use_slog`:receiver・名前付き戻り値による `log` のシャドー | a 修正 | 引数と同じ判定を receiver・result にも適用 | | `rs_no_mocking_library`:`automock` クレート,`pub use`,`use {mockall::automock};` | a 修正 | クレート一覧と `use` の接頭辞を拡張 | | `rs_no_mocking_library`:`cfg_attr` 分岐が入れ子の属性を正規表現で読む(#196 最後のコメント) | a 修正 | 正規表現をやめ,`cfg_attr` の引数トークン(カンマの直後の識別子)をノードで判定 | | `bash_readonly_constant_name`:`declare -r` を検査しない | a 修正 | スクリプト直下の `declare -r` / `typeset -r` と,関数内の `declare -gr` を追加 | | `bash_readonly_constant_name`:関数内の `readonly` を一律に除外 | a Limits | 既存の `local` を固定するだけの `readonly` と区別するにはスコープ解析が要るため,除外のまま規則の Scope に記録した(レビュー指摘で一度検査に変えたが戻した) | | `py_pydantic_base_model_only_in_frozen_base`:`pydantic.v1` 経由の回避 | a 修正 | `pydantic.v1` の素の書き方を追加 | | `go_use_slog`:関数内のローカル変数による `log` のシャドー | a Limits | スコープ解析が要る.規則の本体は精度が高く,demote すると `log.Printf` を止められなくなるため,blocking のまま規則の Limits に記録した | | `go_iota_enum_typed`:`iota + 1` などの式 | a Limits | `1 << (10 * iota)` と `iota + 1` は型なし定数の標準的な書き方で,構文だけでは enum と区別できない.既存の valid fixture のとおり対象外のまま,理由を規則に記録した | | `rs_no_follow_links`:import 別名,途中で別の型に変換するチェーン | a Limits | 別名はバインド解析が要る.変換するチェーンは該当する API を確認できていない.規則の Limits に記録した | | `py_no_pytest_asyncio`:別名 `pytest` 経由 | a Limits | バインド解析が要る.規則の Limits に記録した | | `gha_job_timeout_minutes`:`jobs` 自体が flow mapping | a Limits | 実在の workflow では使われない書き方.規則の Scope に記録した | | `gha_workflow_permissions_deny_all`:ルート全体が flow mapping | a Limits | 同上 | | `gha_pinned_uses_version_comment`:`action.yml` 内の tag 参照 | c | 規則は `action.yml` を対象に含んでいる.tag 参照は対象外と Scope に書いてある設計どおり | | `go_context_param_named_ctx` / `go_no_context_in_struct`:import path・エイリアスの確認 | c | 規則が標準 `context` を別名なしで import したファイルに限定済み | | `go_no_generated_mocks`:`//go:generate` 経由の mock | c | 規則が検出済み | 「a Limits」は,構文だけでは判定できない見逃しの端のケースで,規則は demote せず,規則ファイルの `Limits:`(または `Scope:`)に記録した.精度の高い規則は,見逃しを記録して残す.誤検出が繰り返し出る規則だけを demote する.この方針は ADR-0021 の「Which rules ast-grep may block」に 1 行足した. ## c.obsolete(規則が削除・置換済み) main に該当の規則が無いため,対応不要. - TypeScript:`ts_no_unvalidated_json_cast`,`ts_catch_rethrow_requires_cause`,`ts_no_other_test_framework`,`ts_no_vague_name`,`ts_no_home_dir_in_tests` と各 `tsx_` 版(oxlint・jev-lint へ移行) - Python:`py_async_test_anyio_marker`(削除),`py_pydantic_validate_json`,`py_plain_class_slots`(jev-lint へ降格),`py_frozen_base_model_config`,`py_frozen_base_model_no_override`,`py_definition_order`,`string-literal-is-named-constant` の `parent:` の件 - Go:`go_sealed_interface_sumtype_decl`,`go_error_no_capitalized_message` - Rust:`rs_unit_test_in_test_module`(clippy へ置換),`rs_no_path_from_format`(jev-lint へ降格),`rs_fs_call_needs_context`,`rs_no_get_prefix` - Bash / Actions:`gha_workflow_concurrency`,`gha_workflow_default_shell`,`bash_strict_mode_header`(jev-lint へ降格) ## b.jev-lint model rule の指摘(変更しない) 保留中の fixtures・eval・しきい値の当てはめで扱う.#196 のコメントに記録済みで,この PR では触れない. - `no-exposed-mutable-collection`,`no-comment-restating-code`,`no-reaching-through-collaborators`,`construction-separate-from-execution`,`function-single-purpose`(#191,4 言語) - `error-handled-once`(#190),`fixture-justified`,`frozen-model-subclass-keeps-locked-settings`,`json-parse-uses-model-validate-json`(#192) - Rust の advisory 規則:`conversion-and-query-names-follow-rust-convention`,`serde-types-follow-config-conventions`,`public-types-protect-invariants`,`domain-states-are-enums`,`paths-are-joined-not-formatted`(#193) - Bash / Actions の advisory 規則(#194),TypeScript の advisory 規則(#195) - `test_main_is_thin_selects_func_main_of_package_main` が `command-query-naming` に指摘される件(誤検出と見ている.model rule の判定の話) ## d.hook・文章・インフラ | 項目 | 分類 | 対応 | |---|---|---| | worktree の未追跡 `agents/skills/.claude/` を skill と読み,`tests/test_workflow_skill_layout.py` が失敗する | d 解決済み | main に同じ修正が入っていた(#216 の rebase で採用) | | Stop の `SUBJECT_CAP`(20)で判定が漏れないようにする | d 解決済み | 現在は 250 で,実測の上限を下回らないことをテストが保証している | | 後段の review が失敗すると,同じ指摘で毎ターン Stop を block する | d 修正 | 完了した前段の結果をレシートの `resume` に保存し,失敗した tier だけを再実行する.通知済みの件数(`shown`)も保存し,同じ指摘では二度 block しない | | 後段の review の失敗理由が捨てられ,`incomplete` としか出ない.`skipped_files=1` が実数でない | d 修正 | `Judgement.failure_reason` を結果の行に出し,`skipped_files` は失敗した review のファイル数にした | | 2 tier の review の順序(調整済み committed,調整済み uncommitted,未調整 committed,未調整 uncommitted)のテストが無い | d 修正 | `test_model_rules_resume.py` に順序のテストを追加 | | `scripts/bootstrap_server.sh` が ast-grep を入れない | d 修正 | ast-grep 0.42.1 を sha256 付きで固定し,dprint と同じ zip の経路で入れる(`install_zip_tool`).bats の fixture,Renovate の確認,README を更新 | | `.bats` を ast-grep で Bash として読めるか | d 対応しない | `languageGlobs`(`bash: ["*.bats"]`)で読めることは確認したが,Bash の規則は `.bats` に有効化しない.`@test` ブロックは Bash の文法ではなく,読めても `readonly` や関数名の規則が意図しない形で当たる.hook の `EXTENSIONS` と整形の対象も広がる | | `severity: error` を hook の block 判定に結びつける | d 範囲外 | #203 の範囲 | | Rust `tooling.md` の package-level guard,Go の `t.Parallel()` の文章 | d 対応しない | テンプレートの linter が既に覆っているため,文章は戻さない | | `types.md` の `to_owned()` / `String::from`,`package_design.md` の `pub`,`types.md` の exhaustive match,`errors.md` の `# Panics` の文章 | d 対応しない | 同上(テンプレートの linter が覆う分は戻さない) | ## 検証 - ast-grep の規則テスト:28 件通過,bats:81 件通過(ast-grep の固定を追加) - `uv run pytest`:5198 件通過,4 件失敗.失敗はいずれも model rule の subject 選択テスト(`test_main_is_thin_selects_func_main_of_package_main` など)で,この PR を外した main でも同じく失敗する(この環境での既存の失敗.CI の `test` job は通る) - `ruff check` / `ruff format --check` / `ty`:通過 Refs #74, #196 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: furedea <132188853+furedea@users.noreply.github.com> Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
🤖 I have created a release *beep* *boop* --- ## [0.2.0](v0.1.4...v0.2.0) (2026-11-18) ### Features * add adr-check command for MADR ADRs ([#225](#225)) ([138c542](138c542)) * **adr:** adopt the shared ADR checks ([#226](#226)) ([5c94a78](5c94a78)) * **hooks:** block edits on static rule errors and guard ast-grep-ignore ([#203](#203)) ([f5b3317](f5b3317)) * **hooks:** judge gh calls by effect through a policy table ([#201](#201)) ([db7226d](db7226d)) * **hooks:** keep ask prefixes only for widening authority and promotion ([#199](#199)) ([c3985f6](c3985f6)) * **hooks:** migrate TypeScript style rules to ast-grep and jev-lint checks ([#195](#195)) ([24d1a3e](24d1a3e)) * **lint:** flag Go packages under util and common with an error rule ([#202](#202)) ([de25e1d](de25e1d)) * **lint:** judge ADR rationale with Jev ([#228](#228)) ([cf1c0a3](cf1c0a3)) * **lint:** migrate agents/AGENTS.md rules to model rules and linters ([#191](#191)) ([9e3e37d](9e3e37d)) * **lint:** migrate bash-style and github-actions-style rules to checks ([#194](#194)) ([4e473ba](4e473ba)) * **lint:** migrate go-style rules to ast-grep and jev-lint rules ([#190](#190)) ([296ad84](296ad84)) * **lint:** migrate rust-style prose rules to checks ([#193](#193)) ([e184682](e184682)) ### Bug Fixes * **ci:** run the jev-lint model-rule tests in CI ([#218](#218)) ([1919b06](1919b06)) * **deps:** pin dependencies ([#221](#221)) ([5d083e4](5d083e4)) * **hooks:** deny git options that skip repository hooks ([#212](#212)) ([e10e5b6](e10e5b6)) * **hooks:** judge a cell turned into code from scratch and ignore attribute reasons ([#224](#224)) ([96fb561](96fb561)) * **lint:** close blocking ast-grep rule gaps recorded in [#196](#196) ([#216](#216)) ([fa31947](fa31947)) * **skills:** drop the agent-run verify step that protected records block ([#213](#213)) ([700244d](700244d)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: furedea-release[bot] <353651101+furedea-release[bot]@users.noreply.github.com>
Refs #74(Rust の style 規則の移行)
Refs #196
計画: #74 (comment)
概要
agents/skills/rust-style/の規則を,ADR-0021 の優先順(既存 linter → ast-grep → jev-lint → 文章のまま)で分類し直した(全 193 規則).agents/hooks/lint/rules/rust/に追加(severity: error.静的な規則は linter と同じくブロックする.ユーザー判断).rule-tests/に各 2 件以上の valid / invalid.agents/hooks/lint/model-rules/rust/<id>/rule.ymlに追加.fixture・eval の当てはめ・baseline は延期(ユーザー判断).既存の model rule は変更していない.Cargo.tomlで有効な lint が覆う文章を削除.mainのCargo.toml(確認済み)で有効な lint が完全に覆う文章を削除した.新規プロジェクトは template から作るので,template の設定が規則を実行する(ユーザー方針の変更).lint が覆わない部分(例外,理由,直し方)は残した.jev-lint の規則の文章は ADR-0021 に従い残した.sgconfig.yml,tests/,hook のコード)は変更していない.sgconfig.ymlはruleDirs: [rules]でrules/rust/を拾い,tests/test_model_rule_files.pyは fixture を持たない規則を要求しない.追加した ast-grep 規則(2,すべて
severity: error)rs_no_follow_links,rs_no_mocking_library.rs_no_follow_linksは,noteに「必要なら理由つきの// ast-grep-ignore: rs_no_follow_linksで例外にする」と書いた.呼び出しの連鎖(receiver chain)がWalkDir::new/walkdir::WalkDir::new/WalkBuilder::new/ignore::WalkBuilder::newから始まるときだけ指摘する(receiver が変数や不明な型なら指摘しない.walker が別の receiver の引数にあるだけの場合も指摘しない).filesystem 以外のfollow_links(true)を valid fixture に足した.rs_no_mocking_libraryはmockall::mock!だけを指摘し,import なしのmock!(自前のマクロ)は指摘しない.ブロックする 2 規則すべてに,失敗の理由を書いた
messageと,そのまま適用できる直し方のnoteを付けた.ast-grep から外した規則と理由
ブロックする規則は安定していなければならない.次の規則は review のたびに新しい指摘が出て収束しなかったので,既存の tool に任せるか,文章に戻すことをユーザーが決めた.この基準は ADR-0021 に記録する.
rs_unit_test_in_test_moduletests_outside_test_module(restriction,template-rust の別 PR で有効化.PR はまだ開いていない.入るまでtesting.mdの文章を残す)cfg(testing)をcfg(test)と取り違える.#[cfg(test)]とmodのあいだの/* */で判定が切れる.mod tests;が読み込むsrc/tests.rsは,ファイル名だけでは test 専用か分からないrs_no_path_from_formatpaths-are-joined-not-formatted,助言のみ){}の引数に入れ子で書いたname.replace("/", "_")や,raw string・エスケープしたバックスラッシュ(r"{dir}\\child")の区切りを取り違える.format!/std::format!/alloc::format!と+で同じ意味の書き方が多いrs_no_get_prefixtypes.md,C-GETTER)get_or_insert_withやget_mutのような正当な名前,FFI の C シンボルrs_fs_call_needs_contexterrors.md,filesystem.md)useで取り込んだ関数名の呼び出しが,同名のローカル関数と区別できない.io::Resultを返す薄い wrapper は正当rs_no_io_in_constructortypes.md)Config::parse(path)のように読み込みを役割とする関数.I/O を呼ぶ別の関数に包まれた場合は追えないrs_no_bool_constructor_argtypes.md,C-CUSTOM-TYPE)with_*や builder の setter は正当rs_pub_fn_before_private_fnagents/AGENTS.mdに同じ規則がある)impl内の並びは見えない.関連する関数を近くに置くほうが読みやすい場合があるrs_literal_to_ownedstr_to_string(template-rust の #20,未マージ.入るまで文章は足さない)"x".to_string()とto_owned()とString::fromが同じ意味不安定の型(番号):1 = ファイルの外の情報が要る,2 = データの流れや実行の順番を追う必要がある,3 = 論理式や文法を正規表現で解析している,4 = 同じ意味の書き方が多い.
削除した ast-grep 規則(精度が足りないものはブロックできないため)
以前に追加していた次の規則と rule-tests を削除した.文章は,ast-grep で正確に判定できない推奨なので
rust-styleに残した(下表).rs_unit_test_in_test_module: ast-grep は cfg の展開とファイルの読み込み関係を判定できず,レビューが収束しなかったため削除した.clippy のtests_outside_test_module(restriction)に置き換える.template-rust への有効化は別の PR(まだ開いていない).入るまでtesting.mdの文章を残す.rs_no_get_prefix(C-GETTER),rs_no_bool_constructor_arg(C-CUSTOM-TYPE),rs_no_io_in_constructor,rs_fs_call_needs_context: 文章を残す.rs_pub_fn_before_private_fn: 規則と文章を削除(agents/AGENTS.mdに同じ規則がある).tooling.mdの同趣旨の 1 行も削除した.rs_literal_to_owned: 規則と文章を削除.clippy::str_to_stringを template-rust で有効にする別 PR に移す.String::fromの形も clippy が扱うため,rust-style に文章は足さない.rs_no_vague_name: 先に削除済み(ユーザー判断).追加した jev-lint 規則(5)
domain-states-are-enums,public-types-protect-invariants,filesystem-code-keeps-paths-and-symlinks-safe,conversion-and-query-names-follow-rust-convention,serde-types-follow-config-conventions.jev-lint review --dry-runで,5 規則とも想定した関数・型を subject に選ぶことを確かめた.jev-lintのconversion-and-query-names-follow-rust-conventionはparse自体も選ぶ.tests/test_model_rule_files.pyの Rust の件数(既存 3 規則の subject 数)は変わらない.波 2: linter で有効化する規則
なし.以前に挙げた 7 件(
missing_debug_implementations,unreachable_pub,missing_docs,mod_module_files,wildcard_enum_match_arm,iter_over_hash_type,allow_attributes)は template-rust #19 でmainに入っており,Cargo.tomlを読んで確認した.文章と規則の対応表(全 193 規則)
「元の場所」は
agents/skills/rust-style/references/からの相対パス(origin/mainの行番号).SKILL.mdは規則ではなく参照の索引なので表に含めない.コード例のブロックも含めない.ast-grep の「例のテスト」はrule-tests/<id>.ymlの(良 / 悪)件数.cli.md#L3cli.md#L4cli.md#L5cli.md#L6cli.md#L7cli.md#L8cli.md#L9code_style.md#L5eprintln!for warnings and progress.code_style.md#L6code_style.md#L7tracingonly when the project needs structured logs, spans, or long-running diagnostics.code_style.md#L8code_style.md#L9error-message-names-operation)agents/hooks/lint/model-rules/rust/error-message-names-operation/rule.ymlcode_style.md#L13manager,helper,util, andcommonunless the name is already established locally.code_style.md#L17code_style.md#L18render.rsoverrenderer.rsfor module names.code_style.md#L19install.rsoverinstaller.rsfor module names.code_style.md#L20config.rsoverconfig_manager.rsfor module names.code_style.md#L21RendererorInstalleras type names only when the type owns behavior.code_style.md#L25code_style.md#L26code_style.md#L27wildcard_imports)code_style.md#L28wildcard_imports(テストと prelude は既定で許可))code_style.md#L29asaliases unless they remove ambiguity or follow a local convention.as _など正当な形がある))code_style.md#L30crate::for crate-local imports andsuper::for parent-module test imports.use super::*とcrate::の使い分けは構文から判別できない)code_style.md#L31code_style.md#L35cargo fmt --checkが品質ゲートで確認する)code_style.md#L36rustfmt,cargo fmt --check)cargo fmt --checkcode_style.md#L37code_style.md#L38cargo fmt --checkが品質ゲートで確認する)code_style.md#L39code_style.md#L43code_style.md#L44code_style.md#L45missing_docs)code_style.md#L46code_style.md#L47//!for module-level documentation.code_style.md#L48///for item documentation.code_style.md#L49# Errorswhen the error cases are not obvious.missing_errors_doc)code_style.md#L50# Panics.missing_panics_doc)code_style.md#L51code_style.md#L52config_serialization.md#L3config_serialization.md#L4serde(deny_unknown_fields)where unknown input keys should be rejected.agents/hooks/lint/model-rules/rust/serde-types-follow-config-conventions/rule.ymlconfig_serialization.md#L5config_serialization.md#L6#[serde(rename_all = "...")]to keep serialized field naming consistent.agents/hooks/lint/model-rules/rust/serde-types-follow-config-conventions/rule.ymlconfig_serialization.md#L7#[serde(default)]for optional input fields that have stable defaults.agents/hooks/lint/model-rules/rust/serde-types-follow-config-conventions/rule.ymlconfig_serialization.md#L8#[serde(skip_serializing_if = "Option::is_none")]when absent values should not appear in output.agents/hooks/lint/model-rules/rust/serde-types-follow-config-conventions/rule.ymlconfig_serialization.md#L9#[serde(flatten)]sparingly because it makes schemas less explicit.config_serialization.md#L10config_serialization.md#L11config_serialization.md#L12config_serialization.md#L13config_serialization.md#L14errors.md#L3anyhow::Resultat application and CLI orchestration boundaries where errors are reported to humans an…errors.md#L4errors.md#L5thiserroris appropriate for deriving concrete error types. Do not introduce it just to wrap every possib…errors.md#L6io::Resultの薄い wrapper など)が多く置かない)errors.md#L7error-message-names-operation)agents/hooks/lint/model-rules/rust/error-message-names-operation/rule.ymlerrors.md#L8?for propagation.errors.md#L9unwraporexpectin production code except for impossible states justified by a nearby invar…unwrap_used/expect_used)errors.md#L13Resultfor expected failures.errors.md#L14panic!for logic bugs and impossible states.errors.md#L15get()or explicit validation.indexing_slicing)errors.md#L16# Panics.missing_panics_doc)errors.md#L17todo!,unimplemented!, or debuggingpanic!calls in production code.todo/unimplemented/dbg_macro)debugging panic!だけ残す.panic!の意図は構文から判別できない)errors.md#L18unreachable!only when the type system or previous validation makes the branch impossible.filesystem.md#L3PathandPathBuffor paths. Do not build paths with string concatenation.paths-are-joined-not-formatted,助言のみ)agents/hooks/lint/model-rules/rust/paths-are-joined-not-formatted/rule.ymlfilesystem.md#L4filesystem.md#L5agents/hooks/lint/rules/rust/rs_no_follow_links.ymlagents/hooks/lint/rule-tests/rs_no_follow_links.yml(良 2 / 悪 2)follow_links(true)だけ.jev-lintfilesystem-code-keeps-paths-and-symlinks-safeも併用.文章は残す)filesystem.md#L6DirEntry::file_type()instead ofPath::is_dir()when symlink behavior matters.agents/hooks/lint/model-rules/rust/filesystem-code-keeps-paths-and-symlinks-safe/rule.ymlfilesystem.md#L7filesystem.md#L8filesystem.md#L9agents/hooks/lint/model-rules/rust/filesystem-code-keeps-paths-and-symlinks-safe/rule.ymlpackage_design.md#L5package_design.md#L6package_design.md#L7package_design.md#L8package_design.md#L9cargo test --all-featureswhen features affect compiled code paths.package_design.md#L10package_design.md#L14pubfor APIs intended to be consumed outside the crate.unreachable_pub)package_design.md#L15pub(crate)for items shared across internal modules, including inside private modules when it clarifi…package_design.md#L16package_design.md#L17package_design.md#L18package_design.md#L19#[non_exhaustive]for public enums or structs that may need new variants or fields.package_design.md#L20package_design.md#L21package_design.md#L22agents/hooks/lint/model-rules/rust/public-types-protect-invariants/rule.ymlpackage_design.md#L26package_design.md#L27package_design.md#L28package_design.md#L29package_design.md#L30build.rsuntil native linking, environment probing, or code generation is actually required.package_design.md#L31testing.md#L6cargo testas the default test command.testing.md#L7#[cfg(test)] mod tests.tests_outside_test_module,template-rust の別 PR で有効化)testing.md#L8tests/*.rsfor integration tests that exercise public APIs or CLI behavior.testing.md#L9testing.md#L10testing.md#L11testing.md#L12testing.md#L13testing.md#L14agents/hooks/lint/rules/rust/rs_no_mocking_library.ymlagents/hooks/lint/rule-tests/rs_no_mocking_library.yml(良 3 / 悪 7)mockallなどの使用だけ.fake を優先する指示は残す)testing.md#L15testing.md#L16testing.md#L22cargo mutants --file <path>; repeat--filefor more files.testing.md#L23mutants.out/missed.txt;caught.txt,timeout.txt, andunviable.txtlist the other …testing.md#L25mutants.out/out of version control.testing.md#L29testing.md#L30tests/when testing public API, CLI behavior, or crate-level wiring.testing.md#L31testing.md#L32tests/common/only when multiple integratio…testing.md#L33agents/hooks/lint/rules/rust/rs_no_mocking_library.ymlagents/hooks/lint/rule-tests/rs_no_mocking_library.yml(良 3 / 悪 7)testing.md#L34tooling.md#L5tooling.md#L6cargo add <crate>whencargo addis available.tooling.md#L7cargo add --dev <crate>.tooling.md#L8cargo checkfor a fast compile/type-check pass when tests are not needed yet.tooling.md#L9cargo testfor the default verification pass.tooling.md#L10cargo clippy --all-targets -- -D warningsfor linting.tooling.md#L11Cargo.lockmanually.tooling.md#L12Cargo.lockfor applications, CLI tools, and internal tools.tooling.md#L13Cargo.lockpolicy.tooling.md#L14@latest-style version shortcuts in documentation or committed commands.tooling.md#L15tooling.md#L19tooling.md#L20src/.tooling.md#L21src/main.rsthin for binary crates. It should parse CLI arguments and call library code.tooling.md#L22src/lib.rsand focused modules undersrc/.tooling.md#L23tests/.tooling.md#L24tooling.md#L25examples/only for runnable examples that should compile.tooling.md#L26utils.rsandhelpers.rs; name modules by domain or action..ls-lint.ymlはutils.rsを禁止していない))tooling.md#L44rustfmtdefine formatting. Do not hand-format around rustfmt.cargo fmt --checkが品質ゲートで確認する)tooling.md#L45tooling.md#L46tooling.md#L47mod.rsonly when the existing project already uses that style; otherwise prefermodule_name.rsplus…mod_module_files)mod.rsを使う場合は例外」だけ残す)tooling.md#L48tooling.md#L49tooling.md#L63unsafeby default.unsafe_code = "forbid")tooling.md#L64clippy::pedanticaswarn, withpriority = -1so that per-lint entries in the same table overri…pedantic)tooling.md#L65#[expect(..., reason = "...")]at the site, or a `Cargo.toml…allow_attributes/allow_attributes_without_reason)Cargo.tomlの allow に理由コメントを付ける指示と承認の指示は残す)types.md#L5types.md#L6typealiases and enums before structs that use them.types.md#L7types.md#L8agents/AGENTS.mdに既にある)types.md#L9#[cfg(test)] mod testsat the bottom of the file.items_after_test_module)allに含まれる)types.md#L10implblocks close together.types.md#L14Debugfor most domain structs.missing_debug_implementations)types.md#L15Clone,PartialEq,Eq,Ord, orHashonly when the type actually needs that capability.types.md#L16agents/hooks/lint/model-rules/rust/public-types-protect-invariants/rule.ymltypes.md#L17types.md#L18types.md#L19types.md#L50agents/hooks/lint/model-rules/rust/domain-states-are-enums/rule.ymltypes.md#L51agents/hooks/lint/model-rules/rust/domain-states-are-enums/rule.ymltypes.md#L52agents/hooks/lint/model-rules/rust/domain-states-are-enums/rule.ymltypes.md#L53matchstatements for domain control flow.wildcard_enum_match_arm)types.md#L54Displaywhen the enum has a stable user-facing representation.types.md#L55FromStrorTryFrom<&str>when parsing user input.types.md#L67too_many_lines/too_many_arguments/cognitive_complexityも部分的に覆う))types.md#L68&str,&Path,&[T].types.md#L69types.md#L70types.md#L71types.md#L72Result<T, E>for expected failures.types.md#L73types.md#L74asyncunless the project has real concurrency or nonblocking I/O requirements.types.md#L78as_*:as_str,as_path,as_slice.agents/hooks/lint/model-rules/rust/conversion-and-query-names-follow-rust-convention/rule.ymltypes.md#L79into_*:into_inner,into_path_buf.agents/hooks/lint/model-rules/rust/conversion-and-query-names-follow-rust-convention/rule.ymltypes.md#L80len,status,provider.types.md#L81get_*unless following an existing local convention.get_or_insert_withや FFI など例外が多く,静的規則は置かない)types.md#L82is_*,has_*,can_*, orshould_*.agents/hooks/lint/model-rules/rust/conversion-and-query-names-follow-rust-convention/rule.ymltypes.md#L83parse,try_from, orfrom_str.agents/hooks/lint/model-rules/rust/conversion-and-query-names-follow-rust-convention/rule.ymltypes.md#L87impl AsRef<Path>only at outer convenience boundaries. Inside the codebase, pass&Path.types.md#L88impl Into<String>for constructors that store owned strings.types.md#L89redundant_cloneは nursery)types.md#L90Cowonly when profiling or API shape shows it is worthwhile.types.md#L91&Vec<T>in function parameters.ptr_arg)allに含まれる)types.md#L95Vec<T>for ordered sequences.types.md#L96BTreeMapor sorted vectors when deterministic output order matters.iter_over_hash_type)は反復だけを覆うtypes.md#L97HashMapwhen order is irrelevant and lookup dominates.types.md#L98agents/hooks/lint/model-rules/rust/public-types-protect-invariants/rule.ymltypes.md#L102&strfor borrowed string input andStringfor owned string storage.types.md#L103format!when constructing a new owned string from values.types.md#L104format!("{name}").uninlined_format_args)types.md#L105to_owned()orString::fromwhen converting a string literal toString.clippy::str_to_stringへ移す(template-rust に別 PR で有効化))types.md#L106to_string()in hot or repeated code.inefficient_to_stringが一部を覆う))types.md#L107types.md#L111usizefor indexing and collection lengths.types.md#L112asfor narrowing integer conversions.cast_possible_truncation/cast_possible_wrap/cast_sign_loss)types.md#L113TryFromortry_intowhen a conversion can fail.types.md#L114types.md#L115#196 の指摘への対応
filesystem.mdの「文字列連結で組まない」は規則が部分的にしか覆わないので残した.template lint の方針変更への対応
template-rust の
mainのCargo.tomlを読み,有効な lint が覆う文章を再び削除した(unsafe_code,unwrap_used/expect_used/indexing_slicing,todo/unimplemented,missing_panics_doc/missing_errors_doc/missing_docs,wildcard_imports(pedantic),uninlined_format_args,cast_*,wildcard_enum_match_arm,iter_over_hash_type,unreachable_pub,mod_module_files,pedantic,allow_attributes).tooling.mdの「Recommended package-level guard」は template の設定の複製なので削除した.agent-config の ast-grep 規則に,有効な template lint と重複するものはない.現在の hit(修正はこの PR に含めない)
ast-grep scan --config agents/hooks/lint/sgconfig.yml <repo>を読み取りのみで実行した.残した 2 規則(Rust)の hit はすべて 0 件.既知の限界
後続の作業(レビュー上限で見送り)
3 回目の再レビューで新たに出た指摘.この PR では直さず,後続の Issue(#196)で扱う.
tooling.mdの推奨 package-level guard(unsafe_code,dbg_macro,todo,unimplemented)の削除: 既定で allow の lint が残るという指摘.template-rust の lint が覆う文章を削除する方針に沿った変更なので,方針の判断として fix(lint): address review findings deferred from the #74 migration PRs #196 に残す.rs_no_mocking_library:use {mockall::automock};とpub use mockall::automock;(グループ化・公開された import).conversion-and-query-names-follow-rust-convention(助言のみ): trait のメソッド宣言(function_signature_item)を subject に含める.types.md:to_owned()/String::fromの行を削除したが,template-rust にclippy::str_to_stringはまだ入っていない.package_design.md:unreachable_pubは crate root から到達できるpub fnを覆わないので,「pubは意図した公開 API だけ」の指針に検査がない.types.md: exhaustive match の行を削除した.template-rust はclippy::wildcard_enum_match_armを有効にしているが,関連する jev-lint 規則domain-states-are-enumsは助言のみで fixture がなく,ADR-0021 は未昇格の model rule の文章を残す.昇格するまで行を戻すか,fix(lint): address review findings deferred from the #74 migration PRs #196 で判断する.rs_no_follow_links:WalkDir::new(".").into_crawler().follow_links(true)のように,途中のメソッドが walker を別の型へ変える連鎖.実在の API は確認できていない.walker を返すと分かっているメソッドだけに連鎖を限る案を fix(lint): address review findings deferred from the #74 migration PRs #196 で判断する.errors.md:# Panicsの行を削除した.clippy::missing_panics_docは呼び出し先の panic を追わないので,間接的に panic する公開 API は覆われない.serde-types-follow-config-conventions(助言のみ):#[derive(Deserialize)]と struct のあいだのブロックコメントでfollowsの探索が止まり,subject に選ばれない.rs_no_follow_links:use walkdir::WalkDir as DirWalker;のような import alias の walker は,constructor の名前が固定のため一致しない(見逃し).検証
nix develop --command ast-grep test --config agents/hooks/lint/sgconfig.yml --skip-snapshot-tests: 20 件通過(Rust 2 規則を含む)nix develop --command uv run pytest tests/test_ast_grep_rules.py tests/test_model_rule_files.py: 44 件通過nix develop --command uv run pytest(CI と同じ全体): 4878 件通過,1 件 skipjev-lint rules --no-config -R agents/hooks/lint/model-rules: 18 規則,0 エラー🤖 Generated with Claude Code