From 3270d35d3ffca05b61b1ce35468f8ab3f2960ebb Mon Sep 17 00:00:00 2001 From: Matthieu MOREL Date: Tue, 22 Apr 2025 19:39:35 +0200 Subject: [PATCH] refactor: reorganize .golangci.yml for better clarity and structure Signed-off-by: Matthieu MOREL --- .golangci.yml | 89 +++++++++++++++++++++++---------------------------- 1 file changed, 40 insertions(+), 49 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index d8401bdd6..b8c21d815 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,8 +1,22 @@ -version: "2" -run: - timeout: 10m +formatters: + enable: + - gofmt + - goimports + + exclusions: + generated: lax + + settings: + gofmt: + simplify: true + + goimports: + local-prefixes: + - helm.sh/helm/v4 + linters: default: none + enable: - depguard - dupl @@ -13,60 +27,37 @@ linters: - revive - staticcheck - unused - settings: - depguard: - rules: - Main: - deny: - - pkg: github.com/hashicorp/go-multierror - desc: "use errors instead" - - pkg: github.com/pkg/errors - desc: "use errors instead" - dupl: - threshold: 400 + exclusions: # Helm, and the Go source code itself, sometimes uses these names outside their built-in # functions. As the Go source code has re-used these names it's ok for Helm to do the same. # Linting will look for redefinition of built-in id's but we opt-in to the ones we choose to use. generated: lax + presets: - comments - common-false-positives - legacy - std-error-handling - rules: - - linters: - - revive - text: 'redefines-builtin-id: redefinition of the built-in function append' - - linters: - - revive - text: 'redefines-builtin-id: redefinition of the built-in function clear' - - linters: - - revive - text: 'redefines-builtin-id: redefinition of the built-in function max' - - linters: - - revive - text: 'redefines-builtin-id: redefinition of the built-in function min' - - linters: - - revive - text: 'redefines-builtin-id: redefinition of the built-in function new' - paths: - - third_party$ - - builtin$ - - examples$ -formatters: - enable: - - gofmt - - goimports + + rules: [] + + warn-unused: true + settings: - gofmt: - simplify: true - goimports: - local-prefixes: - - helm.sh/helm/v4 - exclusions: - generated: lax - paths: - - third_party$ - - builtin$ - - examples$ + depguard: + rules: + Main: + deny: + - pkg: github.com/hashicorp/go-multierror + desc: "use errors instead" + - pkg: github.com/pkg/errors + desc: "use errors instead" + + dupl: + threshold: 400 + +run: + timeout: 10m + +version: "2"