file

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const File config.CheckType = "file"
View Source
const FileDiff config.CheckType = "filediff"

Variables

This section is empty.

Functions

func RegisterChecks

func RegisterChecks()

Types

type FileCheck

type FileCheck struct {
	config.CheckBase  `yaml:",inline"`
	Path              string   `yaml:"path"`
	DisallowedPattern string   `yaml:"disallowed-pattern"`
	ExcludePattern    string   `yaml:"exclude-pattern"`
	SkipDir           []string `yaml:"skip-dir"`
}

FileCheck is a simple File absence check which can be for a single file or a pattern.

func (*FileCheck) Merge

func (c *FileCheck) Merge(mergeCheck config.Check) error

Merge implementation for file check.

func (*FileCheck) RequiresData

func (c *FileCheck) RequiresData() bool

RequiresData implementation for file check. Since this check acts on the existence of files on disk, it does not require any data.

func (*FileCheck) RunCheck

func (c *FileCheck) RunCheck()

RunCheck scans a directory for a list of disallowed files, while excluding the provided regex ExcludePattern and skipping the list of provided relative directories.

type FileDiffCheck added in v0.3.1

type FileDiffCheck struct {
	config.CheckBase `yaml:",inline"`
	// TargetFile will be compared with SourceFile.
	TargetFile string `yaml:"target"`
	// SourceFile can be a local file or a remote URI.
	SourceFile string `yaml:"source"`
	// SourceContext list of key-values to compile the source file as a Jinja template.
	SourceContext map[string]any `yaml:"source-context"`
	// ContextLines number of context lines around the line changes.
	ContextLines int `yaml:"context-lines"`
	// IgnoreMissing allows non-existent files to not be counted as a Fail.
	// Using a pointer here so that we can differentiate between
	// false (default value) and an empty value.
	IgnoreMissing *bool `yaml:"ignore-missing"`
}

func (*FileDiffCheck) FetchData added in v0.3.1

func (c *FileDiffCheck) FetchData()

FetchData implementation for FileDiffCheck

func (*FileDiffCheck) Merge added in v0.3.1

func (c *FileDiffCheck) Merge(mergeCheck config.Check) error

Merge implementation for FileDiffCheck check.

func (*FileDiffCheck) RequiresData added in v0.3.1

func (c *FileDiffCheck) RequiresData() bool

RequiresData implementation for FileDiffCheck.

func (*FileDiffCheck) RunCheck added in v0.3.1

func (c *FileDiffCheck) RunCheck()

RunCheck implementation for FileDiffCheck check.

func (*FileDiffCheck) UnmarshalDataMap added in v0.3.1

func (c *FileDiffCheck) UnmarshalDataMap()

UnmarshalDataMap implementation for FileDiffCheck check.

Jump to

Keyboard shortcuts

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