New returns a new Linter instance with given config and rules
(conf *Config, rules []Rule)
| 18 | |
| 19 | // New returns a new Linter instance with given config and rules |
| 20 | func New(conf *Config, rules []Rule) (*Linter, error) { |
| 21 | compiled, err := compilePatterns(conf.EffectiveIgnorePatterns()) |
| 22 | if err != nil { |
| 23 | return nil, err |
| 24 | } |
| 25 | |
| 26 | l := &Linter{ |
| 27 | conf: conf, |
| 28 | rules: rules, |
| 29 | parser: newParser(), |
| 30 | ignorePatterns: compiled, |
| 31 | } |
| 32 | return l, nil |
| 33 | } |
| 34 | |
| 35 | // ParseAndLint checks the given commitMsg string against rules |
| 36 | func (l *Linter) ParseAndLint(commitMsg string) (*Result, error) { |