Skip to content

build: enable nolintlint, paralleltest and revive default rules - #8

Merged
furedea merged 3 commits into
mainfrom
build/74-golangci
Nov 10, 2026
Merged

furedea merged 3 commits into
mainfrom
build/74-golangci

Conversation

@furedea-agent

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

Copy link
Copy Markdown
Contributor

Refs furedea/agent-config#74

概要

段階 1B として,template-go の golangci-lint で無効だった規則を有効化し,出た違反を直した.

  • nolintlint と paralleltest を linters.enable に追加
  • revive は rules を指定すると既定の規則が外れるため,package-comments と exported を独自の 3 規則と併記
  • nolintlint は既定では linter 名と理由を要求しないため,require-specific と require-explanation を true にした(claude-review の P2 への対応)
  • 設定のみのコミットと修正のコミットは分けた

規則の対応表

規則 ID 元の場所 元の規則(原文) 判定 実装 例のテスト 元の文章
nolintlint agents/skills/go-style/references/tooling.md:35 Every //nolint names the linter and carries a reason 既存 linter(nolintlint) .golangci.yml 違反 0(//nolint を使う箇所なし) 残して併記
paralleltest agents/skills/go-style/references/testing.md:9 call t.Parallel() when cases share no state 既存 linter(paralleltest) .golangci.yml main_test.go の TestGreeting で確認 残して併記
package-comments agents/skills/go-style/references/code_style.md:18 Doc comments on exported identifiers start with the identifier name 既存 linter(revive package-comments) .golangci.yml main.go のパッケージコメントで確認 残して併記
exported agents/skills/go-style/references/code_style.md:18 Doc comments on exported identifiers start with the identifier name 既存 linter(revive exported) .golangci.yml 違反 0(exported な識別子なし) 残して併記

paralleltest の「原文」は,並列にできない場合を例外とする文なので,linter が常に強制する範囲より狭い.並列にできないテストは //nolint:paralleltest // <reason> で理由を書く(nolintlint が理由の有無を検査する).

違反数(golangci-lint run ./...,リポジトリ自身の設定)

規則 有効化前 修正後
paralleltest 1(main_test.go:9) 0
revive package-comments 1(main.go:1) 0
nolintlint 0 0
revive exported 0 0
合計 2 0

修正

  • main_test.go: TestGreeting の先頭に t.Parallel() を追加.greeting() は純粋関数でテスト間に共有状態がなく,testing.md:9 の「状態を共有しないなら並列」に当たるため,//nolint:paralleltest で黙らせず実際に並列化するのが正しい.
  • main.go: パッケージコメント // Command template-go prints a greeting and serves as the starting point for new Go projects. を追加.名前の言い換えではなく,このコマンドが何をするかと,テンプレートとしての役割を呼び出し側(godoc の読者)向けに述べている.
  • 抑制コメント,個別の無効化,設定での除外は使っていない.

確認

  • nix develop --command golangci-lint run ./...: 0 issues
  • nix develop --command go test ./...: ok
  • pre-commit(ls-lint,format,lint,commitlint)は通過

計画からの変更

なし.

🤖 Generated with Claude Code

furedea and others added 2 commits November 10, 2026 00:32
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@furedea

furedea commented Nov 9, 2026

Copy link
Copy Markdown
Owner

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 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-09T15:36:57.752442Z
We couldn’t complete this review. Comment @codex review to try again.
14e007d 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.

Comment thread .golangci.yml
- gocognit
- gocyclo
- gosec
- nolintlint

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: With its default settings, nolintlint doesn't enforce the rule this PR maps it to ("Every //nolint names the linter and carries a reason"). require-specific and require-explanation are both false by default, so a bare //nolint or //nolint:paralleltest with no // <reason> still passes. Only unused or malformed directives get reported. The PR description says nolintlint checks that a reason is present, but it won't until these are set:

  settings:
    nolintlint:
      require-specific: true
      require-explanation: true

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

対応しました(14e007d).nolintlint に require-specific: true と require-explanation: true を設定し,golangci-lint run ./... は 0 issues です.

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Review summary

Findings: one P2, nothing blocking. No P0 or P1.

  • P2 .golangci.yml: nolintlint is enabled with its default settings, so require-specific and require-explanation are both off. A //nolint with no linter name or no reason still passes, which means the go-style rule mapped to it isn't enforced yet. To fix it, set settings.nolintlint.require-specific: true and require-explanation: true.

The other changes look correct:

  • paralleltest: t.Parallel() is added to TestGreeting.
  • revive: package-comments and exported are listed explicitly, which is needed because setting rules replaces revive's defaults.
  • Package comment: the new comment follows the // Command ... convention.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@furedea

furedea commented Nov 9, 2026

Copy link
Copy Markdown
Owner

@codex review

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown

Review summary

No findings. I checked the .golangci.yml changes, the new package comment in main.go, and the t.Parallel() call added in main_test.go.

  • The config uses golangci-lint v2, which turns no exclusion presets on by default. That means revive's package-comments and exported rules will report their issues and won't be hidden.
  • The fixes are enough to clear the newly enabled rules. TestGreeting shares no state, so running it in parallel is safe.

Blocking findings (P0/P1): 0

@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.

@furedea
furedea merged commit d5dbc37 into main Nov 10, 2026
16 of 18 checks passed
@furedea
furedea deleted the build/74-golangci branch November 10, 2026 04:58
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