From 609960b5c6f8b0a441d8d90a8a75858799cf9881 Mon Sep 17 00:00:00 2001 From: Rafid Bin Mostofa Date: Mon, 25 Sep 2023 17:00:11 +0600 Subject: [PATCH] ci: configure linters This commit adds a config file ``.golangci.yaml`` for the lint workflow. It removes the previous arguments passed to golangci-lint in favor of the new configuration file. --- .github/workflows/lint.yaml | 1 - .golangci.yaml | 55 +++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .golangci.yaml diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ea1baa6d..cd29cedd 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -27,4 +27,3 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54.1 - args: --disable-all --enable errcheck,staticcheck,unused diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 00000000..e6d81b72 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,55 @@ +linters: + # Disable all linters. + # Default: false + disable-all: true + # Enable specific linter + # https://golangci-lint.run/usage/linters/#enabled-by-default + enable: + - errcheck + - staticcheck + - unused + +issues: + exclude-rules: + # exclusions for errcheck + - path: "^.*/log.go$" + text: "globalLogger.Output.*not checked" + linters: + - errcheck + - path: "^.*_test.go$" + text: "release.Render.*not checked" + linters: + - errcheck + - path: "^.*_test.go$" + text: "release.Walk.*not checked" + linters: + - errcheck + - path: "internal/setup/fetch.go" + text: "lockFile.Unlock.*not checked" + linters: + - errcheck + # exclusions for unused + # addDebugCommand is an useful function that may be used later + - path: "cmd/chisel/main.go" + text: "addDebugCommand.*unused" + linters: + - unused + # exclude common (unused) issues from log.go files + - path: "^.*/log.go$" + text: "logf.*unused" + linters: + - unused + - path: "^.*/log.go$" + text: "debugf.*unused" + linters: + - unused + - path: "^.*/log.go$" + text: "globalDebug.*unused" + linters: + - unused + - path: "^.*/log.go$" + text: "globalLogger.*unused" + linters: + - unused + max-issues-per-linter: 0 + max-same-issues: 0