diff --git a/config/linters-config/.golangci.yml b/config/linters-config/.golangci.yml index e69de29b..2f048116 100644 --- a/config/linters-config/.golangci.yml +++ b/config/linters-config/.golangci.yml @@ -0,0 +1,30 @@ +# 这是我们当前内部使用的配置文件,会基于实际的变化和我们的认知而迭代,仅供参考 + +linters-settings: + paralleltest: + # Ignore missing calls to `t.Parallel()` and only report incorrect uses of it. + # Default: false + # see: https://github.com/qiniu/reviewbot/issues/149 + ignore-missing: true + # Ignore missing calls to `t.Parallel()` in subtests. Top-level tests are + # still required to have `t.Parallel`, but subtests are allowed to skip it. + # Default: false + ignore-missing-subtests: true + +linters: + # Enable all available linters. + enable-all: true + # Disable specific linter + disable: + - nlreturn # see https://github.com/qiniu/reviewbot/issues/148 + - deadcode # Deprecated + - exhaustivestruct # Deprecated + - golint # Deprecated + - ifshort # Deprecated + - interfacer # Deprecated + - maligned # Deprecated + - gomnd # Deprecated + - nosnakecase # Deprecated + - scopelint # Deprecated + - structcheck # Deprecated + - varcheck # Deprecated diff --git a/internal/linters/go/golangci_lint/golangci_lint.go b/internal/linters/go/golangci_lint/golangci_lint.go index 9fa1ee3b..614c3cf4 100644 --- a/internal/linters/go/golangci_lint/golangci_lint.go +++ b/internal/linters/go/golangci_lint/golangci_lint.go @@ -22,6 +22,10 @@ func golangciLintHandler(log *xlog.Logger, a linters.Agent) error { a.LinterConfig.Args = append([]string{}, "run", "--timeout=5m0s", "--allow-parallel-runners=true") } + if a.LinterConfig.ConfigPath != "" { + a.LinterConfig.Args = append(a.LinterConfig.Args, "--config", a.LinterConfig.ConfigPath) + } + return linters.GeneralHandler(log, a, golangciLintParse) }