generated

package
v2.2.6 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 2 Imported by: 1 module, 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 generated recognizes paths that hold generated output rather than work: bytecode caches, installed dependencies, coverage reports, and the files an editor or an operating system leaves lying around.

A repository whose .gitignore misses one of these has it reported as untracked, which git status cannot tell apart from new work. preen holds such a path back from the plan and says why, rather than helping commit something that regenerates itself on the next test run.

Every pattern is overridable. A repository that vendors one of these directories on purpose is a real thing, and the tool has no business overruling it.

Index

Constants

View Source
const Configured = "matched a configured pattern"

Configured is the reason given for a pattern the repository added itself, where preen has no description of its own to offer.

Variables

View Source
var Defaults = []Rule{
	{Pattern: "__pycache__/", Why: "Python bytecode cache"},
	{Pattern: "*.pyc", Why: "compiled Python"},
	{Pattern: "*.pyo", Why: "optimized Python bytecode"},
	{Pattern: ".pytest_cache/", Why: "pytest cache"},
	{Pattern: ".mypy_cache/", Why: "mypy cache"},
	{Pattern: ".ruff_cache/", Why: "ruff cache"},
	{Pattern: "*.egg-info/", Why: "Python packaging metadata"},
	{Pattern: ".venv/", Why: "Python virtual environment"},
	{Pattern: "venv/", Why: "Python virtual environment"},
	{Pattern: "node_modules/", Why: "installed JavaScript dependencies"},
	{Pattern: ".nyc_output/", Why: "JavaScript coverage output"},
	{Pattern: "htmlcov/", Why: "rendered coverage report"},
	{Pattern: "lcov.info", Why: "coverage report"},
	{Pattern: "coverage.out", Why: "Go coverage profile"},
	{Pattern: "coverage.html", Why: "rendered coverage report"},
	{Pattern: "coverage.xml", Why: "coverage report"},
	{Pattern: ".coverage", Why: "Python coverage data"},
	{Pattern: "target/", Why: "build output"},
	{Pattern: ".gradle/", Why: "Gradle cache"},
	{Pattern: "*.class", Why: "compiled Java"},
	{Pattern: ".DS_Store", Why: "macOS directory metadata"},
	{Pattern: "Thumbs.db", Why: "Windows thumbnail cache"},
	{Pattern: "*.swp", Why: "editor swap file"},
	{Pattern: "*.swo", Why: "editor swap file"},
	{Pattern: "*~", Why: "editor backup file"},
	{Pattern: ".idea/", Why: "JetBrains project settings"},
}

Defaults are the patterns preen holds back without being asked.

The list is deliberately short and boring: every entry is output some tool writes and rewrites, and none of them is a file anyone edits by hand. Broad build directories like build/ and dist/ are left out, because plenty of projects keep real source under those names.

Functions

This section is empty.

Types

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

Matcher decides whether a path holds generated output. The zero Matcher matches nothing, which is the shape callers want when the check is off.

func New

func New(extra, allow []string) Matcher

New returns a Matcher over the default patterns plus extra, with anything allow covers exempted. An extra pattern uses the same syntax as a default.

func Off

func Off() Matcher

Off returns a Matcher that holds nothing back, which is what the caller's consent to commit generated output amounts to.

func (Matcher) Match

func (m Matcher) Match(p string) (Rule, bool)

Match returns the rule that catches a path, and whether one did. An allowed path never matches, so a repository can vendor a directory the defaults would otherwise refuse.

type Rule

type Rule struct {
	// Pattern is the path pattern, in the syntax matches documents.
	Pattern string
	// Why names what the pattern catches, so a report can explain the refusal.
	Why string
}

Rule is one never-commit pattern and what it catches.

Jump to

Keyboard shortcuts

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