Skip to content

build(lint): enable ruff D, DOC and N - #137

Merged
furedea merged 1 commit into
mainfrom
build/74-enable-ruff-d-n
Nov 10, 2026
Merged

furedea merged 1 commit into
mainfrom
build/74-enable-ruff-d-n

Conversation

@furedea-agent

@furedea-agent furedea-agent Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

概要

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

@furedea

furedea commented Nov 10, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-10T16:03:30.690918Z
We couldn’t complete this review. Comment @codex review to try again.
7c30403 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

Review summary (read-only): no findings.

  • I checked the whole repo (code, tests, and string-based monkeypatch targets) for the old names: UnsupportedSyntax, UnexpandableGlob, UnplacedCommit, brace_words, and the guard_file helpers that are now private. Nothing still uses them, so the renames are complete.
  • The privatized guard_file helpers (_context, _session, etc.) have no external callers.
  • The pyproject changes (D/N select, D104/D105/D107 ignore, tests D ignore, google convention) look correct.
  • Note: as the description says, ruff check still reports 12 violations, all in the verify-hook lane files. This PR has to stay draft until that PR lands. If it merges first, lint fails on main.

🤖 Generated with Claude Code

@furedea

furedea commented Nov 10, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

Review summary: no blocking findings.

I checked the renames (UnsupportedSyntax→UnsupportedSyntaxError, UnexpandableGlob→UnexpandableGlobError, UnplacedCommit→UnplacedCommitError) and the functions made private in guard_file.py and shell_paths.py across the whole repo, including tests and non-Python files. Nothing still uses an old name. The remaining changes add docstrings and reformat lines, and they don't change behavior. The new docstrings for main (exit codes 1 and 2) and content_text match the code.

Note: as the PR description says, CI ruff check will fail on the 12 violations in the verify-hook files until fix/verify-hook-dev-shell is merged. Keep this PR as a draft until then and rebase onto it.

No new tests are needed, since this PR only renames things and adds lint configuration.

Enable pydocstyle (google convention), pydoclint and pep8-naming exactly
as template-python and dotfiles do: D104, D105 and D107 ignored, D ignored
under tests/**.

Fix the findings in guard_file.py, shell_paths.py and shell_words.py by
privatizing module-internal names and documenting the public API. Rename
UnexpandableGlob, UnsupportedSyntax, UnplacedCommit and UnknownTestCommand
to end in Error (N818) and update every use.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@furedea-agent
furedea-agent Bot force-pushed the build/74-enable-ruff-d-n branch from 3fe521b to 7c30403 Compare November 10, 2026 16:01
@furedea-agent
furedea-agent Bot marked this pull request as ready for review November 10, 2026 16:01
@furedea-agent furedea-agent Bot closed this Nov 10, 2026
@furedea-agent furedea-agent Bot reopened this Nov 10, 2026
@furedea-agent furedea-agent Bot changed the title build(lint): enable ruff D and N build(lint): enable ruff D, DOC and N Nov 10, 2026
@furedea

furedea commented Nov 10, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

Copy link
Copy Markdown

Review summary

No findings: no P0, P1, P2 or P3 issues.

What I checked:

  • Exception renames. I searched the whole repo for the old names UnsupportedSyntax, UnexpandableGlob, UnplacedCommit and UnknownTestCommand. Nothing still uses them in agents/, scripts/, tests/ or non-Python files, including dynamic lookups such as sys.modules["shell_words"].… and side_effect= mocks. The base classes are unchanged (all still subclass ValueError), so the broad except ValueError handlers in guard_file.check/_judged_commit and provider_adapter catch the same errors as before. UnplacedCommitError is still caught before the generic ValueError branch.
  • Functions made private (guard_file ×10, shell_paths._brace_words). Nothing still uses the old names. That includes attribute access, monkeypatch target strings and the recursive call in _brace_words.
  • pyproject.toml. The D/DOC/N selection, the D104/D105/D107 ignores, the tests/** D ignore and the google convention all look consistent.

The changes are mechanical and don't change behavior. The existing tests already cover the renamed exceptions, so no new tests are needed.

🤖 Generated with Claude Code

@furedea
furedea merged commit 0e68ae8 into main Nov 10, 2026
22 of 45 checks passed
@furedea
furedea deleted the build/74-enable-ruff-d-n branch November 10, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant