Skip to content

Commit

Permalink
refactor(lint): rename Lint, LintCommit to ParseAndLint, Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
muthukrishnan24 committed Mar 6, 2022
1 parent 6b6bb3d commit 9bcea31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func runLint(confFilePath, fileInput string) (lintResult string, hasError bool,
return "", false, err
}

result, err := linter.Lint(commitMsg)
result, err := linter.ParseAndLint(commitMsg)
if err != nil {
return "", false, err
}
Expand Down
10 changes: 5 additions & 5 deletions lint/linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ func New(conf *Config, rules []Rule) (*Linter, error) {
return l, nil
}

// Lint checks the given commitMsg string against rules
func (l *Linter) Lint(commitMsg string) (*Result, error) {
// ParseAndLint checks the given commitMsg string against rules
func (l *Linter) ParseAndLint(commitMsg string) (*Result, error) {
msg, err := l.parser.Parse(commitMsg)
if err != nil {
issues := l.parserErrorRule(commitMsg, err)
return newResult(commitMsg, issues...), nil
}
return l.LintCommit(msg)
return l.Lint(msg)
}

// LintCommit checks the given Commit against rules
func (l *Linter) LintCommit(msg Commit) (*Result, error) {
// Lint checks the given Commit against rules
func (l *Linter) Lint(msg Commit) (*Result, error) {
issues := make([]*Issue, 0, len(l.rules))

for _, rule := range l.rules {
Expand Down

0 comments on commit 9bcea31

Please sign in to comment.