Documentation
¶
Index ¶
Constants ¶
const MaxLineLength = 200
MaxLineLength is the max line length that this printer will show the source of the violation and the location within the line of the violation. Helps avoid consuming the console when minified files contain violations.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileResults ¶
type FileResults struct {
Filename string
Results []ResultService
}
FileResults contains all the Results for the file
func (FileResults) Len ¶ added in v0.1.2
func (fr FileResults) Len() int
Len is part of sort.Interface
func (FileResults) Less ¶ added in v0.1.2
func (fr FileResults) Less(i, j int) bool
Less is part of sort.Interface
func (*FileResults) String ¶
func (fr *FileResults) String() string
func (FileResults) Swap ¶ added in v0.1.2
func (fr FileResults) Swap(i, j int)
Swap is part of sort.Interface
type PathResult ¶ added in v0.1.14
type PathResult struct {
Result
}
PathResult is a ResultService meant for showing violations in a file path
func MatchPath ¶ added in v0.1.14
func MatchPath(r *rule.Rule, path string) (rs []PathResult)
MatchPath matches the path against the rule. If it is a match, it will return a PathResult with the line/start column/end column all at 1
func MatchPathRules ¶ added in v0.1.14
func MatchPathRules(rules []*rule.Rule, path string) (rs []PathResult)
MatchPathRules will match the path against all the rules provided
func (PathResult) Reason ¶ added in v0.1.14
func (r PathResult) Reason() string
Reason is the reason for the PathResult violation. It is similar to Result.Reason, but makes it clear that the violation is with the file path and not a line in the file
type Result ¶
type Result struct {
Rule *rule.Rule
Violation string
// Line is the full string of the line, unless it's over MaxLintLength,
// where Line will be an empty string
Line string
StartPosition *token.Position
EndPosition *token.Position
}
Result contains data about the result of a broken rule
func (Result) GetEndPosition ¶ added in v0.1.14
func (Result) GetSeverity ¶ added in v0.1.14
func (Result) GetStartPosition ¶ added in v0.1.14
type ResultService ¶ added in v0.1.14
type ResultService interface {
GetSeverity() rule.Severity
GetStartPosition() *token.Position
GetEndPosition() *token.Position
Reason() string
String() string
GetLine() string
}
func FindResults ¶
func FindResults(r *rule.Rule, filename, text string, line int) (rs []ResultService)
FindResults returns the results that match the rule for the given text. filename and line are only used for the Position