audit

package
v0.45.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package audit reports conventional-commit and prose-restraint findings over a branch's git history. Range rules are advisory; the shared CheckConventionalCommit rule is also consumed at commit time by the repository commit hook. The uncommitted-changes rule additionally inspects the live working tree.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConventionalCommitDocument added in v0.30.0

func ConventionalCommitDocument(findings []Finding) (presentation.Document, error)

ConventionalCommitDocument maps conventional-commit findings for the commit gate.

Types

type Finding

type Finding struct {
	Severity severity.Rank
	Rule     string
	Commit   string // short hash, "" for a branch-level finding
	Subject  string
	Detail   string
}

Finding is one reported conformance issue.

func CheckConventionalCommit added in v0.3.0

func CheckConventionalCommit(c awfgit.Commit, s Settings) []Finding

CheckConventionalCommit validates one commit's subject against the Conventional Commits settings and returns any violations. Merge commits are exempt.

func Run

func Run(ctx context.Context, repoRoot, base, head string, in Inputs) ([]Finding, int, error)

Run collects the caller-supplied commit range and evaluates retained range rules. It also returns the resolved commit count so callers can report the evaluated scope.

type Inputs

type Inputs struct {
	Settings
	GeneratedPaths map[string]bool
	DocsDir        string // e.g. "docs", the authored-prose root
}

Inputs are the resolved audit settings plus the generated and prose paths the retained range rules need.

type Outcome added in v0.40.0

type Outcome struct {
	Report  presentation.Report
	Failed  bool
	Commits int
}

Outcome is the configured audit result for command rendering and exit mapping.

func RunConfigured added in v0.40.0

func RunConfigured(ctx context.Context, root string, cfg *config.Config, base, head string) (Outcome, error)

RunConfigured builds the configured audit input for one repository and returns its audit-owned report for command rendering.

type Settings

type Settings struct {
	AllowedScopes []config.ScopeSpec
}

Settings is the repository's allowed conventional-commit scope vocabulary.

func Resolve

func Resolve(scopes []config.ScopeSpec) Settings

Resolve preserves the one repository-specific audit fact: allowed scopes.

func (Settings) ScopeNames added in v0.8.0

func (s Settings) ScopeNames() []string

ScopeNames returns just the allowed scope names, for gate matching.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL