Skip to main content
A multi-pair LABEL block reads better when keys appear in a stable, logical order. This rule reorders pairs inside a single LABEL instruction so that related image metadata stays grouped and diffs stay small.

Description

Image metadata reads best when keys cluster by purpose. The default oci-logical order follows how reviewers usually scan a LABEL block: The lexical order is a flat alphabetical comparator across all keys. The rule reports when a single multi-pair LABEL instruction has at least two pairs and the configured comparator says they are not in stable order.

Auto-fix

The fix swaps the source text of individual key=value spans inside the existing LABEL, leaving continuation backslashes, indentation, and any surrounding whitespace untouched. Per-pair edits are narrow on purpose so they can co-run with tally/labels/prefer-grouped and tally/newline-per-chained-call without conflicts. The fix is suppressed when:
  • The LABEL is single-line multi-pair. Let tally/newline-per-chained-call split it onto continuation lines first; the next lint pass then reorders.
  • A comment line splits the pairs. Comments mark intentional sections, and the v1 fixer never crosses them.
  • The block contains a duplicate key. Defer to tally/labels/no-duplicate-keys; reordering duplicates would change the effective image metadata.
  • A pair has a dynamic key, an empty key, an expansion error, or uses the legacy LABEL key value form.

Examples

Bad

Good

Configuration