Documentation
¶
Index ¶
- Constants
- Variables
- func DisplayMatchResults(matchedResults []MatcherResult)
- func FindAllInlineReferences(workingDir string) (map[NormalizedPath][]inline.InlineReference, error)
- func FindInlineReferencesInFile(path string) []inline.InlineReference
- func GetStagedFiles(workingDir string) []string
- func LoadGitignore(workingDir string) ([]string, error)
- func LoadSemignore(workingDir string) ([]string, error)
- func MatchesPattern(filePath, pattern string) bool
- func MatchesPatterns(filePath string, patterns []string) bool
- func NormalizedPathsToStrings(paths []NormalizedPath) []string
- type CollectedDocument
- type DocumentCollection
- type DocumentParser
- type DocumentType
- type FileType
- type IgnoreReason
- type Matcher
- type MatcherResult
- type NormalizedPath
- type RuleFileMap
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 LoadGitignore ¶
func LoadSemignore ¶
func MatchesPattern ¶
MatchesPattern checks if a file path matches a single pattern
func MatchesPatterns ¶
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 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 (*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
Click to show internal directories.
Click to hide internal directories.