Skip to content

Commit

Permalink
feat(golangci-lint): use custom config
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlJi committed Jun 7, 2024
1 parent 36ec49e commit 72fe3c6
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
30 changes: 30 additions & 0 deletions config/linters-config/.golangci.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions internal/linters/go/golangci_lint/golangci_lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit 72fe3c6

Please sign in to comment.