Skip to content

Commit

Permalink
feat: new golanngci-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcheng committed Feb 26, 2024
1 parent 400d52e commit 7fe5200
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/linters/go/golangci_lint/golangci_lint.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package golangci_lint

import (
"github.com/qiniu/reviewbot/internal/linters"
"github.com/qiniu/x/xlog"
)

// refer to https://golangci-lint.run/
var lintName = "golangci-lint"

func init() {
linters.RegisterPullRequestHandler(lintName, golangciLintHandler)
}

func golangciLintHandler(log *xlog.Logger, a linters.Agent) error {
if linters.IsEmpty(a.LinterConfig.Args...) {
// turn off compile errors by default
a.LinterConfig.Args = append([]string{}, "run")
}

return linters.GeneralHandler(log, a, linters.GeneralParse)
}
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (

// linters import
_ "github.com/qiniu/reviewbot/internal/linters/git-flow/commit-check"
_ "github.com/qiniu/reviewbot/internal/linters/go/golangci_lint"
_ "github.com/qiniu/reviewbot/internal/linters/go/staticcheck"
_ "github.com/qiniu/reviewbot/internal/linters/lua/luacheck"
)
Expand Down

0 comments on commit 7fe5200

Please sign in to comment.