Documentation ¶
Index ¶
- Constants
- func LoadDefaultRules() (*[]Rule, error)
- func LoadRulesJSON(fPath string) (*[]Rule, error)
- func LoadRulesJSONFromPwd(rulesPath string) *[]Rule
- func ScanDiffs(data []byte, atEOF bool) (advance int, token []byte, err error)
- func SplitDiffHashKey(s string) (string, string)
- func SplitDiffs(r io.Reader, l List) error
- type Checker
- type Diff
- type DiffChecker
- type DiffItem
- type Ignorer
- type List
- type Logger
- type MatchedRules
- type Matcher
- type Result
- type Results
- type Rule
Constants ¶
const ( // RuleTypeRegex is the regex type for pattern matching RuleTypeRegex = "regex" // RuleTypeMatch is the string match type for pattern matching RuleTypeMatch = "match" )
https://github.com/michenriksen/gitrob#signature-keys
const ( // RulePartPath checks the whole path of the file RulePartPath = "path" // RulePartFilename checks the name of the file RulePartFilename = "filename" // RulePartExtension checks the extension of the file RulePartExtension = "extension" )
Variables ¶
This section is empty.
Functions ¶
func LoadDefaultRules ¶
LoadDefaultRules unmarshalls the go generated byte slice of the gitrob JSON rules file
func LoadRulesJSON ¶
LoadRulesJSON reads a file of JSON rules from the local filesystem
func LoadRulesJSONFromPwd ¶
LoadRulesJSONFromPwd reads a rules JSON from a path relative to the process's pwd
func SplitDiffHashKey ¶
SplitDiffHashKey splits a DiffItem's hash key
Types ¶
type DiffChecker ¶
DiffChecker checks an io.Reader for matches against the supplied ruleset
type DiffItem ¶
type DiffItem struct {
// contains filtered or unexported fields
}
DiffItem is a diff struct for an inidividual file
func (*DiffItem) GetHashKey ¶
GetHashKey returns the hash key identifier for the diff
type Ignorer ¶
type Ignorer struct {
// contains filtered or unexported fields
}
Ignorer is used to exclude content in .secignore files
func NewIgnorer ¶
NewIgnorer will create an Ignorer from a read stream
func NewIgnorerFromFile ¶
NewIgnorerFromFile will safely create an Ignorer whether the file exists or not
type Logger ¶
type Logger interface { Print(v ...interface{}) Printf(format string, v ...interface{}) }
Logger is the logger interface
type MatchedRules ¶
MatchedRules is slice of matched rules for each file in diff [fPath] => Rule{rule1, rule2}
type Result ¶
type Result struct { // Have any of the files matches against the rules? Matched bool MatchedRules MatchedRules }
Result compiles the results of matched rules for a diff