Documentation
¶
Overview ¶
Package globpath provides glob matching and pattern utilities for mdsmith config surfaces: ignore:, overrides:, kind-assignment:, and rule settings (allowed:, include:, exclude:, budgets[].glob).
The catalog directive uses SplitIncludeExclude from this package to split !-prefixed exclusion patterns; include resolution and exclude matching in the catalog use doublestar directly with full-path semantics.
CLI argument expansion uses doublestar.FilepathGlob directly and does not route through this package; !-prefix exclusion is not available on the CLI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ContainsDotDotSegment ¶ added in v0.15.0
ContainsDotDotSegment reports whether p contains a ".." path element when split on "/". Filenames like "..foo" do not match.
func Match ¶
Match reports whether path matches pattern using the doublestar matcher. It checks the raw path, the cleaned path, and the base name so that patterns without path separators (e.g. "slides.md") match files in any directory. Invalid patterns return false.
func MatchAny ¶
MatchAny reports whether path matches any of the given patterns. A pattern prefixed with "!" is an exclusion pattern. The path matches when at least one non-negated pattern matches and no exclusion pattern matches; an exclusion pattern always wins over an inclusion pattern, regardless of list order. A list containing only exclusion patterns matches nothing.
func ResolveAgainstRoot ¶ added in v0.15.0
ResolveAgainstRoot resolves p against baseDir (both slash-separated and relative to a project root) and reports whether the cleaned result escapes the project root via ".." segments.
baseDir == "" or "." is interpreted as the project root. The returned path is also slash-separated and relative to the project root; it is "" for the root itself.
Callers use this to check that ".." segments in a path stay within the project root before resolving the path against a project-rooted fs.FS.
func SplitIncludeExclude ¶
SplitIncludeExclude separates patterns into include and exclude lists. Patterns prefixed with "!" are exclusion patterns (the prefix is stripped).
Types ¶
This section is empty.