prosegate

package
v0.41.0 Latest Latest
Warning

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

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

Documentation

Overview

Package prosegate enforces punctuation restraint across a project's tracked text files. It rejects en dashes and paragraphs containing three or more em dashes while permitting ellipses and curly quotes.

Index

Constants

This section is empty.

Variables

This section is empty.

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 accepts the five formerly guarded codepoints so existing adopter exemptions remain compatible.

func Result added in v0.40.0

func Result(findings []Finding) (checkresult.Result, error)

Result adapts completed prose findings to immutable owner-classified results.

Types

type Exemption

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

Exemption permits a guarded codepoint in a path, optionally pinning its whole-file occurrence 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
	Paragraph int
	Pinned    *int
}

Finding is one punctuation-restraint violation. Paragraph is nonzero for an em-dash threshold violation and identifies the blank-line-delimited text block within the file. Pinned is non-nil for an exemption count mismatch.

func Scan

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

Scan reports punctuation-restraint violations in the supplied staged text files. Files whose contents are not valid UTF-8 are silently skipped.

type ViolationCounts added in v0.40.0

type ViolationCounts struct {
	EnDashes     int
	EmDashExcess int
}

ViolationCounts is the comparable policy measure used by the historical advisory: all en dashes plus em dashes beyond the allowance of two in each paragraph.

func CountViolations added in v0.40.0

func CountViolations(text string) ViolationCounts

CountViolations measures the guarded punctuation in text. A whitespace-only line is blank, CRLF and LF delimit paragraphs identically, and empty blocks between consecutive blank lines are ignored.

Jump to

Keyboard shortcuts

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