Ancora.Trailer (ancora v1.0.0)

Copy Markdown View Source

Parses Spec-Ack: git trailers into a severity override map.

Grammar: Spec-Ack: <code>=<info|warning>. Codes must be registry codes. The trailer is downgrade-only: error and off are rejected at parse, and Ancora.Severity further rejects a value higher than the resolved config severity. There are no presets.

Unknown codes or severities emit a [CONFIG] warning on stderr and are ignored, never silently dropped.

Scope: base..HEAD, not HEAD-only

read/2 shells git log <base>..HEAD --format=%B and unions parsed overrides across every commit in the range. HEAD-only scanning is wrong: CI often sees squash or merge commits where the trailer lives one commit deep.

Trailers are a cooperative self-report. read/2 does not verify signatures or authorship. This is suited to single-author and small-team workflows; larger teams should pair trailers with code review.

Summary

Functions

Parses one or more commit messages into an override map.

Reads git log <base>..HEAD --format=%B in root and returns the union of parsed overrides across every commit in the range.

Types

override_map()

@type override_map() :: %{optional(String.t()) => Ancora.Severity.severity()}

parse_result()

@type parse_result() :: %{overrides: override_map(), warnings: [String.t()]}

Functions

parse(body)

@spec parse(binary()) :: parse_result()

Parses one or more commit messages into an override map.

read(root, base)

@spec read(String.t(), String.t()) :: parse_result()

Reads git log <base>..HEAD --format=%B in root and returns the union of parsed overrides across every commit in the range.