From 64f3019844a5bb4f5a39fc1719a43c9671bb8536 Mon Sep 17 00:00:00 2001 From: Daniel Canter Date: Tue, 24 Aug 2021 06:24:44 -0700 Subject: [PATCH] Add stylecheck linter to golangci-lint CI run This change adds the stylecheck linter to our golangci-lint ci run. This catches a few nice things like double imports, checking if errors end with punctuation/aren't capitalized. It also by default checks if common initialisms (CPU, ID, HTTP, TLS) are in all caps, but this sets off a metric ton of errors because of the amount of generated schema files we have. We could exclude these directories from being linted altogether, but would like to hear what others think. I don't see a way to exclude directories for only certain checks (so if someone knows a way please do tell) Signed-off-by: Daniel Canter --- .github/workflows/ci.yml | 2 +- .golangci.yml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .golangci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b872db8d77..ad2101c658 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: - name: golangci-lint uses: golangci/golangci-lint-action@v2 with: - version: v1.38.0 + version: v1.42.0 # Has fixes for stylecheck configuration https://github.com/golangci/golangci-lint/pull/2017/files args: --timeout=5m test: diff --git a/.golangci.yml b/.golangci.yml new file mode 100644 index 0000000000..11a2af7300 --- /dev/null +++ b/.golangci.yml @@ -0,0 +1,8 @@ +linters: + enable: + - stylecheck + +linters-settings: + stylecheck: + # https://staticcheck.io/docs/checks + checks: ["all", "-ST1003"] \ No newline at end of file