Repository navigation
docs: tighten and cut comments in the remaining packages - #696
Merged
Merged
Conversation
Rewrite doc and inline comments across the production packages not covered by earlier passes. Comments that restated the code are deleted; exported names keep a one-line doc. What remains states an invariant, a failure guarded against, an ordering reason, a security or concurrency contract, or a unit or range. Comment-only: the AST of every changed file, with comments stripped, is identical to the parent commit. Directives are unchanged. Lines for comments that now pass are removed from the comment baseline. Signed-off-by: Ion Alpha <contact@ionalpha.io>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Rewrites the doc and inline comments in 142 production Go files across 56 packages that the earlier comment passes did not cover (controlplane, diag, capability, resource, the internal release, sigstore, selfupdate, vault and integration packages, and others). Comments that restated the code are deleted; every exported name keeps a one-line doc. Comment lines in the changed files go from 6263 to 4698.
Why
Doc comments are the published API reference. Many of these restated the signature or narrated how the code came to be, which buries the comments that carry an invariant, a failure being guarded against, an ordering reason, a security or concurrency contract, or a unit. What remains says something the code does not.
How to verify
The change is comment-only. For every changed
.gofile, the AST with comments stripped is identical to the same file onmain; editing one token in a copy (maxConflictRetriesinresource/retry.go) makes that comparison report a difference. No//go:,//nolintor build-constraint line is added, removed or changed.go build ./...,./dev/lint(0 issues) andgo test ./internal/rigor/...pass locally, and./dev/testpassed on all 56 changed packages.TestCommentsStayTersepasses with 34 lines removed frominternal/rigor/testdata/comment_baseline.txtand none added.Notes for reviewers
The blocks still over 14 lines are package comments (limit 40), kept because they state the security or ordering contract for the whole package:
internal/portregister,internal/release,internal/sigstore,internal/hostneutral,internal/projectctxandgovbench.The
inertext.Escapedoc now writes the bidirectional override as the textinstead of the literal character, which gosec flags.