Skip to content

Commit

Permalink
fix(luacheck) filter out unnecessary lines
Browse files Browse the repository at this point in the history
  • Loading branch information
xwen-winnie committed Jun 20, 2024
1 parent c4ca1ce commit 893f4fc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/linters/lua/luacheck/luacheck.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package luacheck

import (
"regexp"
"strings"

"github.com/qiniu/reviewbot/internal/linters"
Expand Down Expand Up @@ -28,6 +29,11 @@ func luacheckHandler(log *xlog.Logger, a linters.Agent) error {
}

func luacheckParser(line string) (*linters.LinterOutput, error) {
// To filter out lines starting with "Total: " or "Checking "
filterRegex := regexp.MustCompile(`^(Total: |Checking )`)
if filterRegex.MatchString(line) {
return nil, nil

Check warning on line 35 in internal/linters/lua/luacheck/luacheck.go

View check run for this annotation

qiniu-x / golangci-lint

internal/linters/lua/luacheck/luacheck.go#L35

return both the `nil` error and invalid value: use a sentinel error instead (nilnil)
}
lineResult, err := linters.GeneralLineParser(line)
if err != nil {
return nil, err
Expand Down

0 comments on commit 893f4fc

Please sign in to comment.