prosegate

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package prosegate scans a project's tracked text files for the seven banned typographic punctuation substitutes (ADR-0119). It is the presence-level counterpart to the net-increase audit rule in internal/audit: this package answers "is the tree clean", not "did this commit make it worse".

Index

Constants

This section is empty.

Variables

View Source
var Banned = map[rune]string{
	'\u2014': "em-dash (U+2014)",
	'\u2013': "en-dash (U+2013)",
	'\u2026': "ellipsis (U+2026)",
	'\u2018': "left single quote (U+2018)",
	'\u2019': "right single quote (U+2019)",
	'\u201c': "left double quote (U+201C)",
	'\u201d': "right double quote (U+201D)",
}

Banned maps each banned rune to its display name. Each key is written as an escape, never as the character: this file is itself a tracked file the scan reads, so a typed glyph here would make the scanner fail its own gate. internal/project/residue_scan_test.go's bannedRunes map is the precedent and must stay in agreement with this one. Notation (arrows, mathematical symbols, accented letters) is deliberately absent: this is a closed blocklist of substitutes for ASCII punctuation, never an ASCII-only allowlist.

Functions

func Format

func Format(f Finding) string

Format renders one finding as a diagnostic line.

func ParseCodepoint

func ParseCodepoint(s string) (rune, error)

ParseCodepoint turns a "U+2014" spelling into its rune. It rejects anything outside the banned set, so a typo cannot silently widen an exemption.

Types

type Exemption

type Exemption struct {
	Path      string
	Codepoint rune
	Count     *int
}

Exemption permits a codepoint in a path, optionally pinning its count.

type File

type File struct {
	Path  string
	Bytes []byte
}

File is one staged regular file supplied by the command's git snapshot.

type Finding

type Finding struct {
	Path   string
	Rune   rune
	Count  int
	Pinned *int
}

Finding is one banned codepoint in one file, with the number found. Pinned is non-nil when an exemption pinned a count that did not match, carrying the pin (which may legitimately be zero); nil when the codepoint was not exempt at all.

func Scan

func Scan(files []File, exemptions []Exemption) ([]Finding, []string, error)

Scan reports every banned rune in the supplied staged files outside the exemptions. Files whose contents are not valid UTF-8 are skipped: a default-deny gate must not guess at binary input.

Jump to

Keyboard shortcuts

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