Repository navigation
docs(hooks): document the public API of hooks/lib and privatize internals - #130
Conversation
|
@codex review |
Codex Review Summary: ❌ FailedThis 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. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Review summaryNo blocking findings (P0/P1: 0). This PR does three things: it renames internal helpers to private ( Verified:
No logic changed, so no new tests are needed. I could not run pytest in this environment; my check relies on the grep and the diff above. 🤖 Generated with Claude Code |
…nals Prepare ruff D (google) and N for agents/hooks/lib. A name used only inside its own module becomes private instead of getting a filler docstring; real public API states its contract. Refs #74 Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
83d4edb to
b2134e2
Compare
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Review summary: no findings. This PR only renames module-internal helpers to private names and adds docstrings. I didn't see any behavior change.
I could not run the test suite in this environment. This review is static only. |
## 概要 ruff の D (pydocstyle, google),DOC,N (pep8-naming) を有効化する最終 PR (#74 stage 1B の持ち越し分).設定は template-python / dotfiles と同じ形にした.先行 lane (#130, #131, #132, #133) の修正は既にマージ済みで,この PR は残りの違反を直したうえで設定を有効化する. `ruff check .` は有効化後の設定で 0 件.ブランチは 1 コミットで,lefthook の全フックを除外なしで通過している. Refs #74 ## 設定 (pyproject.toml) - `select` に `D`,`DOC`,`N` を `W` と `F` の間に追加 (template-python / dotfiles と同じ並び).`DOC` による新規指摘は 0 件を確認済み - `ignore` に `D104`,`D105`,`D107` を追加 - `per-file-ignores` の `tests/**` に `D` を追加 - `[tool.ruff.lint.pydocstyle] convention = "google"` を追加 既存の ignore は削除していない. ## この PR での修正 ### 改名 (N818) ドメイン概念はそのまま,`Error` 接尾辞のみ追加し,agents と tests の全使用箇所を更新した. - `UnexpandableGlob` → `UnexpandableGlobError` - `UnsupportedSyntax` → `UnsupportedSyntaxError` - `UnplacedCommit` → `UnplacedCommitError` - `UnknownTestCommand` → `UnknownTestCommandError` ### 非公開化 (外部から使われないことを `git grep` で agents/ scripts/ tests/ に対して確認) | ファイル | 件数 | 名前 | | ---------------- | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `guard_file.py` | 10 | `_policy_path`, `_load_policy`, `_protected_reason`, `_validate_filename_rule`, `_commit_reason`, `_content_match`, `_scan_content`, `_judged_commit`, `_context`, `_session` | | `shell_paths.py` | 1 | `_brace_words` | ### docstring を書いた公開 API | ファイル | 件数 | 名前 | 理由 | | ---------------- | ---- | ----------------------------------------------- | ------------------------------------------------------------------ | | `guard_file.py` | 3 | `commit_filename_rules`, `content_text`, `main` | テストと CLI から使われる公開 API | | `shell_words.py` | 1 | `home_directory` | `tests/hooks/test_shell_words.py` が直接呼ぶため非公開化しなかった | docstring は名前の言い換えではなく,返す値・拒否する入力・例外を述べている. ## リポジトリ全体の内訳 (ac-dn の全 lane) | PR | 非公開化 | docstring 追加 | 改名 (N818) | | -------------------------------------------- | -------: | -------------: | -----------------: | | #130 (hooks/lib) | 38 | 23 | 0 (他に表記修正 2) | | #131 (session_store ほか 4 ファイル) | 48 | 20 | 0 | | #133 (hooks/\*.py, scripts, skills, tests) | 44 | 15 | 2 | | #132 (verification_session, check_execution) | 8 | 7 | 0 | | この PR | 11 | 4 | 4 | | 合計 | 149 | 69 | 6 | #130 と #133 の件数は各 PR 本文の表,#131 は本文の合計行,#132 は ac-dn の表 (非公開化 7 + `collect`,文書化 `main`/`dispatch`/`failure`/`Status`/`Result`/`Result.failed`/`execute`) による. ## 検証 - `ruff check .`: All checks passed - `ruff format --check .`: 239 files already formatted - `ty check`: All checks passed - `pytest`: 手元 (sandbox) では 2 件を除き通過.失敗は `tests/hooks/test_formatter_config.py` の dprint 統合テスト 2 件のみで,sandbox が `plugins.dprint.dev` への通信を遮断するため (この PR の変更とは無関係).CI で確認する - pre-commit (lefthook) は `LEFTHOOK_EXCLUDE` なしで全フック通過 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: furedea <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
概要
ruff の D (google) と N を有効化するための準備です(#74 stage 1B の持ち越し分).
agents/hooks/lib/のうち担当ファイルを,pyproject.tomlを変更せずに D/N 違反ゼロにします.対応内容
_始まりにし,モジュール内の呼び出しを更新ctimeを大文字始まりに,バックスラッシュを含む docstring を raw 文字列にprivate 化と根拠
git grep -nwをagents/scripts/tests/に対して実行し,定義元モジュール以外にヒットがないことを確認しました.automation_paths:stays_insidecommand_objections:is_pinned_callcommand_policy:validate_rule,is_name_list,all_patternsformatter_policy:js_config_toolgit_safety:git_reason,full_optionherdr_grammar:any_word,number,one_of,acceptspowershell_options:is_powershell,is_with_argssecret_path_policy:normalize,candidate(_is_candidate)session_snapshot:is_confinedshell_input:redirected_inputs,stdin_operator,reads_process_substitution,static_script,computed_inputshell_inspection:is_plain_quoted,text_without_nodes,outermost_spans,plain_pipeline_statementshell_syntax:statement_writes,redirect_operator,is_foreign_shell,foreign_option_indexesshell_wrappers.OptionScan:flags,valued,take_value,value_at,refusetrusted_owners:origin_repository,cached_answer,rememberdocstring を付けたもの
command_objections.Policyの 3 プロパティ,command_policy.prefix_reasonherdr_grammar.is_watch_command/has_global_optionhook_decision.ask/deny,patch_input.paths/added_textsecret_path_policy.load/blocked_rulesession_snapshot.Snapshotのdigest/changed_paths/to_json/from_jsonshell_input.InputSources.of,shell_syntax.Command.has_dynamic_words/program_is_dynamicshell_wrappers.OptionScan.runtrusted_owners.TrustedOwners/declares,github_answer(テストがmonkeypatchで差し替えるため公開のまま)名前の言い換えではなく,拒否する入力・例外・副作用・非自明な制約を書いています.
対象外(最終の有効化 PR で対応)
check_selection.UnknownTestCommandの N818(brief の指示どおり持ち越し)shell_syntax.Command.__post_init__の D105(目標設定で ignore)検証
ruff check --select D,N --ignore D104,D105,D107+ google convention(担当ファイル):UnknownTestCommandの N818 のみruff check/ruff format --check/ty check: 通過pytest: 4531 passed, 1 skippedRefs #74
🤖 Generated with Claude Code