walker

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorHandler

type ErrorHandler func(error) error

ErrorHandler handles found TODO references. It can return SkipAll or SkipDir.

type Options

type Options struct {
	// TODOFunc handles when TODOs are found.
	TODOFunc TODOHandler

	// ErrorFunc handles when errors are found.
	ErrorFunc ErrorHandler

	// Config is the config for scanning todos.
	Config *todos.Config

	// Charset is the character set to use when reading the files or 'detect'
	// for charset detection.
	Charset string

	// ExcludeGlobs is a list of Glob that matches excluded files.
	ExcludeGlobs []glob.Glob

	// ExcludeDirGlobs is a list of Glob that matches excluded dirs.
	ExcludeDirGlobs []glob.Glob

	// IncludeHidden indicates whether hidden paths should be processed. Hidden
	// paths are always processed if there are specified explicitly in `paths`.
	IncludeHidden bool

	// IncludeVendored indicates whether vendored paths should be processed. Vendored
	// paths are always processed if there are specified explicitly in `paths`.
	IncludeVendored bool

	// IncludeVCS indicates that VCS paths (.git, .hg, .svn, etc.) should be included.
	IncludeVCS bool

	// Paths are the paths to walk to look for TODOs.
	Paths []string
}

Options are options for the walker.

type TODOHandler

type TODOHandler func(*TODORef) error

TODOHandler handles found TODO references. It can return SkipAll or SkipDir.

type TODORef

type TODORef struct {
	FileName string
	TODO     *todos.TODO
}

TODORef represents a TODO in a specific file.

type TODOWalker

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

TODOWalker walks the directory tree and scans files for TODOS.

func New

func New(opts *Options) *TODOWalker

New returns a new walker for the options.

func (*TODOWalker) Walk

func (w *TODOWalker) Walk() bool

Walk walks the paths and scans files it finds for TODOs. It does not fail when it encounters errors. It instead prints an error message and returns true if errors were encountered.

Jump to

Keyboard shortcuts

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