docs(agents): add errorlint rule, lint gate, and local overlay#590
docs(agents): add errorlint rule, lint gate, and local overlay#590yuanchen8911 wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
8f176cd to
bc3463e
Compare
bc3463e to
e92af26
Compare
e92af26 to
82c94a3
Compare
ArangoGutierrez
left a comment
There was a problem hiding this comment.
LGTM. Good addition -- the stderrors.Is alias note is particularly useful since that is a common stumbling point when pkg/errors shadows stdlib.
068acbb to
c98d9db
Compare
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdded "Local Overlay" handling and Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
AGENTS.md (1)
299-308:⚠️ Potential issue | 🟡 MinorSame formatting issue as CLAUDE.md (blank lines around code fence).
This section has the same MD031 compliance issue as
.claude/CLAUDE.mdlines 299-308. SinceAGENTS.mdis auto-synced from the canonical source, fixing the blank lines in.claude/CLAUDE.mdwill resolve this in both files.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@AGENTS.md` around lines 299 - 308, The Markdown fenced code block that shows the Go example comparing err == io.EOF vs errors.Is(err, io.EOF) needs blank lines immediately before and after the triple-backtick fence to satisfy MD031; update the canonical CLAUDE.md source section that contains the Go example (the block referencing errors.Is and io.EOF) to add the missing blank lines around the code fence so the autogenerated AGENTS.md will be corrected on sync.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.claude/CLAUDE.md:
- Around line 299-308: The Markdown fenced code block around the Go example
needs blank lines before the opening ```go fence and after the closing ``` fence
to satisfy MD031; edit the fenced block that contains the "BAD - fails
errorlint..." and "GOOD - works with wrapped errors..." examples so there is an
empty line immediately above the opening ```go and an empty line immediately
below the closing ```; do not change the code, only insert the two blank lines
surrounding the fence.
In `@AGENTS.md`:
- Around line 299-308: Replace the sentinel error comparison "if err == io.EOF
{" in the test that contains that check with the idiomatic errors.Is(err,
io.EOF) call; if the file imports github.com/pkg/errors and aliases the stdlib
as stderrors, use stderrors.Is(err, io.EOF) instead to handle wrapped errors and
satisfy the errorlint rule.
---
Duplicate comments:
In `@AGENTS.md`:
- Around line 299-308: The Markdown fenced code block that shows the Go example
comparing err == io.EOF vs errors.Is(err, io.EOF) needs blank lines immediately
before and after the triple-backtick fence to satisfy MD031; update the
canonical CLAUDE.md source section that contains the Go example (the block
referencing errors.Is and io.EOF) to add the missing blank lines around the code
fence so the autogenerated AGENTS.md will be corrected on sync.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 65647f4f-7480-4bcb-bbb5-f47093028b0b
📒 Files selected for processing (2)
.claude/CLAUDE.mdAGENTS.md
c98d9db to
eb9746d
Compare
eb9746d to
cd8ed8a
Compare
cd8ed8a to
fd97976
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.claude/CLAUDE.md:
- Line 502: Update the inline CLI example in the "**Mandatory lint gate for Go
changes:**" section so it follows the repo markdown style: prefix the command
with the component name, use explicit flag form and camelCase flag names (e.g.,
componentName command --camelCaseFlag value), and replace the current inline
example at that location with the revised component-prefixed, explicit-flag
version.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c0f3fe9b-a3f1-4743-9b83-441772c6e561
📒 Files selected for processing (3)
.claude/CLAUDE.md.gitignoreAGENTS.md
4e964fb to
dbec211
Compare
Add: - errorlint rule (errors.Is for sentinel checks) with BAD/GOOD examples - mandatory pre-PR golangci-lint gate for any Go change, including PRs labeled as documentation-only - 'Local Overlay' section pointing agents to AGENTS.local.md when present, for per-clone personal rules that should not be committed - AGENTS.local.md entry in .gitignore Kept CLAUDE.md and AGENTS.md in sync.
dbec211 to
7d576a1
Compare
Summary
Add three rules to CLAUDE.md and AGENTS.md:
errorlintrule with BAD/GOOD examples for sentinel error checks (errors.Isinstead of==).golangci-lintgate for any Go change, including PRs labeled as documentation-only.AGENTS.local.mdin the repo when present, and treat it as a per-clone additive layer.Also gitignore
AGENTS.local.mdso personal overlays stay out of the shared repo.Motivation / Context
referencedAssertFilesusederr == io.EOFwhich was rejected bygolangci-lint. The rule was only mentioned in the Troubleshooting table as a hint, not as an explicit coding pattern.make qualify, so the lint error was not caught before push. The mandatory gate prevents this class of oversight for both Claude Code and Codex agents.AGENTS.local.mdif present, treat as additive and lower-priority than the sharedAGENTS.md— gives both Claude and Codex a consistent way to pick up personal preferences (e.g., per-user issue-filing conventions) without committing them to the shared repo.Related: #587
Type of Change
Component(s) Affected
docs/,examples/)Implementation Notes
errors.Is()rule to Error Wrapping Rules section with BAD/GOOD code examples and a note aboutstderrors.Is()aliasing in files importingpkg/errorsAGENTS.local.mdAGENTS.local.mdto.gitignoretools/check-agents-syncstill passesTesting
N/A — documentation only, no code changes.
Risk Assessment
Checklist
git commit -S)Summary by CodeRabbit