Repository navigation
build(golangci-lint): require guard clauses instead of else after return - #11
Conversation
Enable the revive rules indent-error-flow, superfluous-else and early-return so the linter rejects an else branch after an if block that ends with return, 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 only changes config: it adds the revive rules 🤖 Generated with Claude Code |
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
概要
.golangci.ymlの revive ルールにindent-error-flow,superfluous-else,early-returnを追加しました.return/continue/breakで終わるifブロックの後ろにelseを置くコードを,文章ルールではなくリンターで拒否します.変更前後の例
変更前(リンターを通過する):
変更後(
indent-error-flowが報告する):ガード節に書き直すと通ります:
検証
ピン留めされた golangci-lint 2.14.0(
nix develop経由)で確認しました.indent-error-flowで報告されることを確認し,サンプルは削除済み(コミットしていない)golangci-lint run: 0 issuesgo test ./...: passgo vet ./...: 指摘なし補足
使い捨てサンプルでは
superfluous-elseとearly-return固有の報告は出ていません(indent-error-flowが先に同じ構造を報告したため).両ルールが設定として有効であることは,設定エラーが出ないことで確認しています.🤖 Generated with Claude Code