processor

package
v0.0.0-...-f67893b Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Markdown = "md"
	HTML     = "html"
	TXT      = "txt"
	PDF      = "pdf"
	UNKNOWN  = "unkown"
)

Variables

View Source
var (
	ErrorCollectingBadURL                         = errors.New("error collecting document, bad URL")
	ErrorCollectingUnknownDocumentType            = errors.New("error collecting document, unknown document type")
	ErrorCollectingNoDocumentParser               = errors.New("error collecting document, no document parser for document type")
	ErrorAnchorNotSupportedOnUnstructuredDocument = errors.New("error collecting document, fragment or anchor not supported on this document")
	ErrorParsing                                  = errors.New("error parsing document")
)
View Source
var IgnoredPaths = []string{"**/.git",
	"**/.svn",
	"**/.hg",
	"**/.jj",
	"**/CVS",
	"**/.DS_Store",
	"**/Thumbs.db",
	"**/.classpath",
	"**/.settings"}

Functions

func DisplayMatchResults

func DisplayMatchResults(matchedResults []MatcherResult)

func FindAllInlineReferences

func FindAllInlineReferences(workingDir string) (map[NormalizedPath][]inline.InlineReference, error)

func FindInlineReferencesInFile

func FindInlineReferencesInFile(path string) []inline.InlineReference

func GetStagedFiles

func GetStagedFiles(workingDir string) []string

func LoadGitignore

func LoadGitignore(workingDir string) ([]string, error)

func LoadSemignore

func LoadSemignore(workingDir string) ([]string, error)

func MatchesPattern

func MatchesPattern(filePath, pattern string) bool

MatchesPattern checks if a file path matches a single pattern

func MatchesPatterns

func MatchesPatterns(filePath string, patterns []string) bool

MatchesPatterns checks if a file path matches any of the given patterns

func NormalizedPathsToStrings

func NormalizedPathsToStrings(paths []NormalizedPath) []string

Types

type CollectedDocument

type CollectedDocument struct {
	Type DocumentType
	// contains filtered or unexported fields
}

func CollectDocument

func CollectDocument(url *url.URL) (CollectedDocument, error)

func UnstructuredDocument

func UnstructuredDocument(content []byte) CollectedDocument

func (*CollectedDocument) GetAnchoredSection

func (s *CollectedDocument) GetAnchoredSection(anchor string) (string, error)

func (*CollectedDocument) IsStructuredDocument

func (s *CollectedDocument) IsStructuredDocument() bool

type DocumentCollection

type DocumentCollection struct {
	DocumentCache map[string]CollectedDocument
}

func NewDocumentCollection

func NewDocumentCollection() DocumentCollection

func (*DocumentCollection) GetDocument

func (dc *DocumentCollection) GetDocument(path string) (string, error)

type DocumentParser

type DocumentParser interface {
	Parse(content []byte) (CollectedDocument, error)
}

func NewHTMLParser

func NewHTMLParser() DocumentParser

func NewMarkdownParser

func NewMarkdownParser() DocumentParser

type DocumentType

type DocumentType string

type FileType

type FileType int
const (
	FileTypeIgnored FileType = iota
	FileTypeSpec
	FileTypeImpl
)

type IgnoreReason

type IgnoreReason int
const (
	IgnoreReasonNone IgnoreReason = iota
	IgnoreReasonIgnore
	IgnoreReasonExcludedByRule
	IgnoreReasonNoRuleMatch
)

func (IgnoreReason) String

func (r IgnoreReason) String() string

type Matcher

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

func NewMatcher

func NewMatcher(cfg *config.Config, workingDir string) (*Matcher, error)

func (*Matcher) GetAllMatcherResults

func (m *Matcher) GetAllMatcherResults() []MatcherResult

TODO: GetAllMatcherResults doesn't use MatchFile function, therefore there is some code duplication here Returns all implementation and specification files from all rules

func (*Matcher) GetRuleImplFiles

func (m *Matcher) GetRuleImplFiles(ruleName string) []NormalizedPath

Should this really be a method on the matcher?

func (*Matcher) GetRuleSpecFiles

func (m *Matcher) GetRuleSpecFiles(ruleName string) []NormalizedPath

Should this really be a method on the matcher?

func (*Matcher) MatchFiles

func (m *Matcher) MatchFiles(inputFiles []string) ([]MatcherResult, error)

type MatcherResult

type MatcherResult struct {
	Path         NormalizedPath
	Type         FileType
	RuleName     string
	IgnoreReason IgnoreReason
}

type NormalizedPath

type NormalizedPath string

func NormalizePath

func NormalizePath(path string) NormalizedPath

type RuleFileMap

type RuleFileMap map[string][]NormalizedPath

mapping rule names to a list of files

Jump to

Keyboard shortcuts

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