Repository navigation
build(ruff): require guard clauses instead of else after return - #28
Conversation
Enable RET505, RET506, RET507 and RET508 so the linter rejects an else branch after an if block that ends with return, raise, continue or break. 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: No findings. This PR adds RET505, RET506, RET507 and RET508 to 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
概要
elseをreturn/raise/continue/breakの後ろに置くコードを,散文のルールではなくリンターで拒否するようにします.pyproject.tomlの[tool.ruff.lint] selectにRET505,RET506,RET507,RET508の4つだけを追加しました(RETグループ全体は有効化していません).固定版 ruff 0.15.11 で確認したところ,4つとも preview 限定ではないため,通常のルール ID として追加しています.Before / After
Before(許可されていた):
After(
RET505で拒否される):検証
if x: return 1+else: return 2)をリポジトリ内に置き,uv run ruff checkがRET505を報告することを確認しました.サンプルは削除済みで,コミットには含まれません.uv run ruff check: 通過(既存コードに新しい指摘なし)uv run ruff format --check: 通過uv run ty check: 通過uv run pytest -q: 1 passedIssue はありません.計画からの逸脱もありません.
🤖 Generated with Claude Code