discover

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFilenames = []string{".gitlab-ci.yml", ".gitlab-ci.yaml"}

DefaultFilenames are the default CI configuration filenames to search for

View Source
var DefaultIgnorePatterns = []string{
	".git",
	"node_modules",
	"vendor",
	".venv",
	"__pycache__",
	"venv",
	"env",
	".tox",
	"target",
	"build",
	"dist",
	"out",
	".next",
	".nuxt",
	"coverage",
	".cache",
}

DefaultIgnorePatterns are directories to skip during recursive search

Functions

This section is empty.

Types

type Discoverer

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

Discoverer handles file discovery operations

func NewDiscoverer

func NewDiscoverer() *Discoverer

NewDiscoverer creates a new file discoverer with default settings

func (*Discoverer) FindFromDirectory

func (d *Discoverer) FindFromDirectory(startDir string) (*FileDiscovery, error)

FindFromDirectory walks up from a given directory looking for CI files

func (*Discoverer) FindInCurrentAndParents

func (d *Discoverer) FindInCurrentAndParents() (*FileDiscovery, error)

FindInCurrentAndParents walks up the directory tree looking for CI files Starts from the current directory and searches up to maxDepth levels

func (*Discoverer) FindInDirectoryTree

func (d *Discoverer) FindInDirectoryTree(root string) (*FileDiscovery, error)

FindInDirectoryTree recursively searches a directory tree for all CI files.

Depth Limiting:

  • Respects the maxDepth setting set via SetMaxDepth() (default: 10 levels)
  • Depth is calculated relative to the root directory provided
  • For example, with maxDepth=2 and root="/home/user/project":
  • /home/user/project/.gitlab-ci.yml (depth 0) ✓
  • /home/user/project/subdir/.gitlab-ci.yml (depth 1) ✓
  • /home/user/project/subdir/nested/.gitlab-ci.yml (depth 2) ✓
  • /home/user/project/subdir/nested/deep/.gitlab-ci.yml (depth 3) ✗

Ignore Patterns:

  • Respects ignore patterns set via SetIgnorePatterns()
  • Default ignores: .git, node_modules, vendor, build, dist, *.tar.gz

func (*Discoverer) SetFilenames

func (d *Discoverer) SetFilenames(filenames []string)

SetFilenames sets the filenames to search for

func (*Discoverer) SetIgnorePatterns

func (d *Discoverer) SetIgnorePatterns(patterns []string)

SetIgnorePatterns sets the directory ignore patterns

func (*Discoverer) SetMaxDepth

func (d *Discoverer) SetMaxDepth(depth int)

SetMaxDepth sets the maximum depth for parent directory search

func (*Discoverer) ValidateAndExpandPaths

func (d *Discoverer) ValidateAndExpandPaths(paths []string) (*FileDiscovery, error)

ValidateAndExpandPaths validates files and expands directories recursively Returns a list of valid file paths and any errors encountered

type FileDiscovery

type FileDiscovery struct {
	Files  []string
	Errors []error
}

FileDiscovery contains discovered files and any errors encountered

Jump to

Keyboard shortcuts

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