Reviewer · Documentation
Accurate, synchronized documentation
Comments and doc strings must precisely and completely describe the current behavior/contract of the code, not narrate the history of a change (that belongs in the commit message). When updating a doc comment, check it against existing sentences for contradictions, and reconcile them so the full comment reads consistently — e.g. if a function's return value...
Comments and doc strings must precisely and completely describe the current behavior/contract of the code, not narrate the history of a change (that belongs in the commit message). When updating a doc comment, check it against existing sentences for contradictions, and reconcile them so the full comment reads consistently — e.g. if a function’s return value or error handling changes, don’t leave an old statement that conflicts with the new behavior. Explicitly document edge cases, scope, and limits of a contract (for example, state clearly what a context-scoped setting does and does not propagate to, or clarify misleading examples in a function’s doc comment) so callers aren’t left guessing. For non-obvious workarounds (e.g. a poll/retry added only for a specific CI/runtime environment), add a short comment or link explaining why it’s there, so future maintainers can decide if it’s still needed. When code is auto-generated, the “DO NOT EDIT” marker must match the required format (^// Code generated .* DO NOT EDIT\.$) so tooling can detect it. Finally, whenever a change affects public API surface (new fields, parameters, behaviors), update all related documentation artifacts together — e.g. api/swagger.yaml, api/docs/CHANGELOG.md, and any relevant doc comments — so the API reference and code stay in sync.
Example of fixing an internally contradictory doc comment:
// SizeReaderAt is an interface used to get a ReaderAt as well as the size of
// the underlying reader.
// The size may shrink due to truncation; growth or other mutation of the
// underlying data is not supported. If truncation is detected while locating
// the tail, scanning restarts at the shortened end. The returned reader is
// not a snapshot of the underlying data.