processors

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseReferenceInclude

func ParseReferenceInclude(include string) (string, string)

Types

type DockerInstruction

type DockerInstruction struct {
	Directive string
	Arguments string
}

func ParseDockerfile

func ParseDockerfile(reader io.Reader) ([]DockerInstruction, error)

type DockerProcessor

type DockerProcessor struct {
}

func (DockerProcessor) Process

func (d DockerProcessor) Process(path string, repoName string, content string) ([]Match, error)

func (DockerProcessor) Supports

func (d DockerProcessor) Supports(filePath string) bool

type FilePatternsProcessor

type FilePatternsProcessor struct {
	Patterns []Pattern
}

func NewFilePatternsProcessor

func NewFilePatternsProcessor(fs fs.FS) *FilePatternsProcessor

func (*FilePatternsProcessor) CompilePatterns

func (s *FilePatternsProcessor) CompilePatterns()

func (*FilePatternsProcessor) Process

func (s *FilePatternsProcessor) Process(path string, repoName string, content string) ([]Match, error)

func (*FilePatternsProcessor) Supports

func (s *FilePatternsProcessor) Supports(path string) bool

type FileProcessor

type FileProcessor interface {
	Supports(filePath string) bool

	Process(path string, repoName string, content string) ([]Match, error)
}

FileProcessor is an interface that defines a generic processor.

func InitializeProcessors

func InitializeProcessors() []FileProcessor

InitializeProcessors creates and returns a slice of FileProcessor implementations.

type LibrariesProcessor

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

func NewLibrariesProcessor

func NewLibrariesProcessor() *LibrariesProcessor

func (*LibrariesProcessor) Process

func (mp *LibrariesProcessor) Process(path string, repoName string, content string) ([]Match, error)

func (*LibrariesProcessor) Supports

func (mp *LibrariesProcessor) Supports(filePath string) bool

type Library

type Library struct {
	Name     string `json:"library_name"`
	Language string `json:"language"`
	Version  string `json:"version"`
}

type Match

type Match struct {
	Name       string                 `json:"name,omitempty"`
	Type       string                 `json:"type,omitempty"`
	Category   string                 `json:"category,omitempty"`
	Properties map[string]interface{} `json:"properties,omitempty"`
	Path       string                 `json:"path,omitempty"`
	RepoName   string                 `json:"repo_name,omitempty"`
}

type Pattern

type Pattern struct {
	Name                 string   `json:"name,omitempty"`
	Type                 string   `json:"type,omitempty"`
	Category             string   `json:"category,omitempty"`
	Filenames            []string `json:"file_names,omitempty"`
	FileExtensions       []string `json:"file_extensions,omitempty"`
	ContentPatterns      []string `json:"content_patterns,omitempty"`
	FilenameRegexs       []*regexp.Regexp
	ContentPatternRegexs []*regexp.Regexp
	Properties           map[string]interface{} `json:"properties,omitempty"`
}

func LoadAllPatterns

func LoadAllPatterns(f fs.FS) ([]Pattern, error)

Jump to

Keyboard shortcuts

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