From fb826919a67484ca50434f9623b2ceabb994b923 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 14 Jun 2023 15:03:37 +0200 Subject: [PATCH] added linter --- scnserver/.golangci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ scnserver/Makefile | 7 ++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 scnserver/.golangci.yml diff --git a/scnserver/.golangci.yml b/scnserver/.golangci.yml new file mode 100644 index 0000000..87aab9b --- /dev/null +++ b/scnserver/.golangci.yml @@ -0,0 +1,40 @@ +# https://golangci-lint.run/usage/configuration/ + +run: + go: '1.20' + +linters: + enable-all: true + disable: + - golint # deprecated + - exhaustivestruct # deprecated + - deadcode # deprecated + - scopelint # deprecated + - structcheck # deprecated + - varcheck # deprecated + - nosnakecase # deprecated + - maligned # deprecated + - interfacer # deprecated + - ifshort # deprecated + - dupl # (i disagree) + - ireturn # (i disagree) + - wrapcheck # (waiting for bferr) + - goerr113 # (waiting for bferr) + - varnamelen # (too many false-positives) + - gomnd # (i disagree) + - depguard # (not configured) + - gofumpt # (we do not use gofumpt) + - gci # (we do no use gci) + - lll # (i disagree) + - gochecknoglobals # (i disagree) + +issues: + exclude-rules: + - path: api/handler/.*.go + linters: + - funlen + +linters-settings: + tagalign: + align: true + sort: false diff --git a/scnserver/Makefile b/scnserver/Makefile index 5529fe4..11f7486 100644 --- a/scnserver/Makefile +++ b/scnserver/Makefile @@ -5,7 +5,7 @@ PORT=9090 NAMESPACE=$(shell git rev-parse --abbrev-ref HEAD) HASH=$(shell git rev-parse HEAD) -.PHONY: test swagger pygmentize docker +.PHONY: test swagger pygmentize docker migrate dgi pygmentize lint build: swagger pygmentize fmt mkdir -p _build @@ -91,3 +91,8 @@ migrate: CGO_ENABLED=1 go build -v -o _build/scn_migrate -tags "timetzdata sqlite_fts5 sqlite_foreign_keys" ./cmd/migrate ./_build/scn_migrate +lint: + # curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.53.2 + golangci-lint run ./... + +