file

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultExclusions

func DefaultExclusions() []string

Types

type CompiledFormat

type CompiledFormat struct {
	Regex            *regexp.Regexp
	DocumentationUrl *string
	LockFileRegexes  []*regexp.Regexp
}

func NewCompiledFormat

func NewCompiledFormat(format *Format) (*CompiledFormat, error)

func (*CompiledFormat) MatchFile

func (format *CompiledFormat) MatchFile(filename string) bool

func (*CompiledFormat) MatchLockFile

func (format *CompiledFormat) MatchLockFile(filename string) bool

type Finder

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

func NewFinder

func NewFinder(c client.IDebClient) (*Finder, error)

func (*Finder) GetGroups

func (finder *Finder) GetGroups(rootPath string, exclusions []string, lockfileOnly bool) (Groups, error)

GetGroups return all file groups in specified path recursively.

func (*Finder) GetSupportedFormats

func (finder *Finder) GetSupportedFormats() ([]*CompiledFormat, error)

GetSupportedFormats returns all supported dependency file formats

type Format

type Format struct {
	Regex            string   `json:"regex"`
	DocumentationUrl string   `json:"documentationUrl"`
	LockFileRegexes  []string `json:"lockFileRegexes"`
}

type Group

type Group struct {
	FilePath       string          `json:"dependencyFile"`
	CompiledFormat *CompiledFormat `json:"-"`
	RelatedFiles   []string        `json:"lockFiles"`
}

func NewGroup

func NewGroup(filePath string, format *CompiledFormat, relatedFiles []string) *Group

func (*Group) GetAllFiles

func (fileGroup *Group) GetAllFiles() []string

func (*Group) HasFile

func (fileGroup *Group) HasFile() bool

func (*Group) Print

func (fileGroup *Group) Print()

type Groups

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

func (*Groups) Add

func (gs *Groups) Add(g Group)

func (*Groups) GetFiles

func (gs *Groups) GetFiles() []string

func (*Groups) Match

func (gs *Groups) Match(format *CompiledFormat, path string, lockfileOnly bool) bool

Match `format` with `path` and append result to Groups

func (*Groups) Size

func (gs *Groups) Size() int

func (*Groups) ToSlice

func (gs *Groups) ToSlice() []Group

type IFinder

type IFinder interface {
	GetGroups(rootPath string, exclusions []string, lockfileOnly bool) (Groups, error)
	GetSupportedFormats() ([]*CompiledFormat, error)
}

Jump to

Keyboard shortcuts

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