rules

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDetector

func LoadDetector() (*detect.Detector, error)

LoadDetector composes upstream + embedded + ~/.ctxcop/*.toml + $CTXCOP_RULES, applies $CTXCOP_DISABLE_RULES, caches.

Panic recovery: a single bad rule (regex compile, etc.) must never crash a hook handler. On panic we fall back to upstream defaults.

func ProjectConfigPath

func ProjectConfigPath() string

ProjectConfigPath returns the discovered .ctxcop.toml path or "".

func ProjectSkipPaths

func ProjectSkipPaths() []string

ProjectSkipPaths returns the project's skip_paths, fed into skiplist via main's SkipPathsFromProject wiring.

func Reset

func Reset()

Reset clears the cache. Tests only. Also resets project-config discovery so a test can point the cwd-walk at a fresh temp dir.

Types

type RuleInfo

type RuleInfo struct {
	ID          string
	Description string
	Source      Source
	SourcePath  string
	Disabled    bool
	// Overridden is true when a higher-priority source redefined this ID.
	// Source/SourcePath then hold the *effective* (winning) definition, and
	// OverriddenFrom names the source that was shadowed. This is what lets
	// `rules list` report effective state instead of the pre-override lie.
	Overridden     bool
	OverriddenFrom Source
}

func List

func List() ([]RuleInfo, error)

List returns every rule with provenance. Used by `ctxcop rules list`.

type Source

type Source string
const (
	SrcUpstream Source = "upstream-default"
	SrcEmbedded Source = "ctxcop-embedded"
	SrcUser     Source = "user-file"
	SrcProject  Source = "project-file"
	SrcEnv      Source = "env-file"
)

Jump to

Keyboard shortcuts

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