reviewignore

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package reviewignore parses a repo's root `.reviewignore` file — gitignore syntax — into a matcher the size gate uses to exclude non-reviewable paths (vendored deps, generated mocks, dark-factory pipeline state) from the added-line and changed-file counts that decide whether a PR parks at human_review.

The file is by construction a way to hide code from review, so visibility is the control rather than restriction: callers report how much was excluded, and the file can never exclude itself (see Parse).

Index

Constants

View Source
const Filename = ".reviewignore"

Filename is the repo-root path of the ignore file. It is also the one path no pattern may ever match — see Parse.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher interface {
	// Match reports whether path is excluded. path is repo-relative and
	// slash-separated, matching the GitHub API's changed-file name form.
	Match(path string) bool

	// Empty reports whether the matcher holds no patterns, so Match is false
	// for every path. Callers use this to skip work that only an actual
	// exclusion would justify — notably the per-file GitHub API call the
	// size gate would otherwise make for every repo, opted in or not.
	Empty() bool
}

Matcher reports whether a repo-relative path is excluded from review.

func Parse

func Parse(content []byte) Matcher

Parse is named for what it does to the input, not `NewMatcher` — it mirrors `maintainerconfig.Parse`, the sibling repo-root config parser this package was modeled on, and the stdlib `time.Parse`/`url.Parse` shape.

Parse builds a Matcher from `.reviewignore` content. Empty, blank or all-comment content yields a matcher that excludes nothing — an absent or empty file is never an implicit "ignore everything".

Parse enforces the self-exclusion guard: the returned Matcher reports false for Filename regardless of the patterns. The guard is applied after matching rather than by filtering patterns at parse time, because a pattern can reach `.reviewignore` through a `**` glob, a bare `*`, or negation ordering — the post-match override is total where pattern filtering would leak. The consequence is deliberate: `.reviewignore`'s own added lines always count toward the size gate and never appear in the reported excluded count, so a repo cannot use the file to conceal edits to the file itself.

Jump to

Keyboard shortcuts

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