prcheck

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package prcheck runs the PR check of design 07 section 5 on a range: every change names exactly one capability whose slug is in the map as that change leaves it, and the map passes physa check map. It holds the result, each commit with the capability it names, the trailer findings and the map's problems, and renders it as a short markdown summary. It reports; whether a finding blocks is the caller's policy.

Index

Constants

View Source
const (
	PRAnchorsGitHub   = mapcheck.PRAnchorsGitHub
	PRAnchorsFormOnly = mapcheck.PRAnchorsFormOnly
)

How the map's PR anchors were checked.

View Source
const Version = 3

Version is the version of the result's JSON shape.

Variables

This section is empty.

Functions

func WriteMarkdown

func WriteMarkdown(w io.Writer, r Result) error

WriteMarkdown writes the short summary of r.

Types

type MapResult

type MapResult struct {
	Problems  []Problem `json:"problems"`
	PRAnchors string    `json:"pr_anchors"` // PRAnchorsGitHub or PRAnchorsFormOnly
	Note      string    `json:"note,omitempty"`
}

MapResult is the map's check as the PR leaves it.

type Problem

type Problem struct {
	Path    string `json:"path"`
	Line    int    `json:"line"`
	Message string `json:"message"`
}

Problem is one problem the map check found.

func Problems

func Problems(ps []mapfile.Problem) []Problem

Problems converts the map reader's problems.

type Result

type Result struct {
	Version  int               `json:"version"`
	Range    string            `json:"range"`
	Commits  []history.Commit  `json:"commits"`
	Findings []history.Finding `json:"findings"`
	Map      MapResult         `json:"map"`
}

Result is what the deterministic PR check found.

func Run

func Run(dir string, repo vcs.Repo, rng string, prExists func(n int) (bool, error)) (Result, error)

Run checks the range rng of repo against the map under dir, the repo's working directory: the commits' trailers against the map as each commit leaves it, and the map's own check, with commit anchors resolved in repo and #N anchors through prExists (nil checks them for form only). The error is for a map, a history or a range that cannot be read.

func (Result) Clean

func (r Result) Clean() bool

Clean reports whether the check found nothing: no trailer findings and no map problems.

func (Result) MarshalJSON

func (r Result) MarshalJSON() ([]byte, error)

MarshalJSON encodes empty commits, findings and problems as [], never null.

func (Result) Title

func (r Result) Title() string

Title is a one-line summary of the result.

Jump to

Keyboard shortcuts

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