Awesome Reviewers

Reviewer · Naming Conventions

Semantic, consistent naming

Choose identifiers (types, fields, functions, methods, variables, import aliases) that precisely describe what they represent and that match existing naming patterns elsewhere in the codebase, so readers don't have to guess or get misled.

Instruction

Choose identifiers (types, fields, functions, methods, variables, import aliases) that precisely describe what they represent and that match existing naming patterns elsewhere in the codebase, so readers don’t have to guess or get misled.

Guidelines to apply:

  • Name for accuracy over brevity: if a field or function only partially represents what its generic name implies, rename it to reflect the actual semantics. E.g. a field collecting only locally-present content should be AllPresentContent, not AllContent.
  • Avoid collisions with similarly-named but semantically different concepts already in the codebase. E.g. prefer IsNonRootClient over IsRootlessClient to avoid confusion with an existing IsRootless (daemon rootless mode) check. Similarly, prefer domain-specific terms like SourceID/TargetID over ContainerID/HostID when the existing OCI terms would be reversed/misleading in this context.
  • Keep exported vs. unexported naming consistent with scope: if a type/field/function is only used internally, don’t export it—give it a lowercase, concise name (e.g. content instead of AllPresentContent when it’s package-internal).
  • Match naming conventions already established by generated code or sibling packages for consistency (e.g. name a constructor NewClient because that’s the convention used in wire.gen.go for other extension points), and keep import aliases consistent with the rest of the codebase—only alias a package when necessary to avoid a conflict; otherwise use the default name.
  • Avoid shadowing an outer variable name when refactoring loops or closures; pick a distinct, semantically meaningful name (e.g. use o for each item instead of reusing v, which already denotes a different value in the same scope).

Example:

// Avoid: ambiguous/misleading, and shadows outer variable
for _, v := range slices.Backward(rc.options) {
    k, v, _ := strings.Cut(v, ":") // shadows outer v
}

// Prefer: clear naming for each loop variable
for _, o := range slices.Backward(rc.options) {
    k, v, _ := strings.Cut(o, ":")
}

Before merging, check that each new or renamed identifier: (1) accurately reflects behavior/scope, (2) doesn’t collide in meaning with an existing identifier, and (3) follows the naming/aliasing conventions already used in related code.</description>