mirror of
https://github.com/mgechev/revive.git
synced 2024-11-28 08:49:11 +02:00
318db94210
* Separating lib from cli * Renamed NewRevive to New * Added GetLintFailures helper function * Moved formatter to call to format since that's when it's needed * makes fields of Revive struct non-public * minor modifs in tests: remove unnamed constats * Added lint package management to lint command * README message for using revive as a library * README formatting * Removed unused method * Slightly improved wording in README * Handling format errors * Renaming file to better reflect intent * Refactoring pattern usage * README heads * renames excludePaths into excludePatterns Co-authored-by: Bernardo Heynemann <bernardo.heynemann@coinbase.com> Co-authored-by: chavacava <salvadorcavadini+github@gmail.com>
34 lines
698 B
Go
34 lines
698 B
Go
package revivelib
|
|
|
|
// LintPattern indicates a pattern to be included/excluded when linting
|
|
type LintPattern struct {
|
|
isExclude bool
|
|
pattern string
|
|
}
|
|
|
|
// IsExclude - should this pattern be included or excluded when linting
|
|
func (p *LintPattern) IsExclude() bool {
|
|
return p.isExclude
|
|
}
|
|
|
|
// GetPattern - returns the actual pattern
|
|
func (p *LintPattern) GetPattern() string {
|
|
return p.pattern
|
|
}
|
|
|
|
// Include this pattern when linting
|
|
func Include(pattern string) *LintPattern {
|
|
return &LintPattern{
|
|
isExclude: false,
|
|
pattern: pattern,
|
|
}
|
|
}
|
|
|
|
// Exclude this pattern when linting
|
|
func Exclude(pattern string) *LintPattern {
|
|
return &LintPattern{
|
|
isExclude: true,
|
|
pattern: pattern,
|
|
}
|
|
}
|