From f1418a7a31e5655cd3c734ad0feb0d83c3e5053d Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Thu, 24 Dec 2020 13:48:00 +0500 Subject: [PATCH] Linting improvements. --- .golangci.yml | 16 +++++++++------- internal/common/version_info.go | 1 + internal/httpserver/handler.go | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index cba426f..ed618db 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,17 +3,10 @@ run: linters: enable-all: true disable: - # Because globals might exist, but according to our codestyle they - # should be lowercased and considered as unexported. - - gochecknoglobals # While it might be useful it'll create more problems that will solve. - gocritic - # Complains about main() lengths, which isn't an issue. - - funlen # Magic numbers might be everywhere. Disabled for now. - gomnd - # ToDos everywhere - - godox # Why? WHY? WHY _test??? - testpackage linters-settings: @@ -23,3 +16,12 @@ linters-settings: min-complexity: 40 gocognit: min-complexity: 40 + funlen: + lines: 200 + +issues: + exclude-rules: + # There will be some ToDos. + - linters: + - godox + text: "TODO" diff --git a/internal/common/version_info.go b/internal/common/version_info.go index 92df57c..f798af6 100644 --- a/internal/common/version_info.go +++ b/internal/common/version_info.go @@ -1,5 +1,6 @@ package common +// nolint:gochecknoglobals var ( Branch string Build string diff --git a/internal/httpserver/handler.go b/internal/httpserver/handler.go index 654e7a8..8124d82 100644 --- a/internal/httpserver/handler.go +++ b/internal/httpserver/handler.go @@ -13,6 +13,7 @@ import ( "go.dev.pztrn.name/metricator/internal/models" ) +// nolint:gochecknoglobals var ( errInvalidAPIVersion = errors.New("invalid API version") errInvalidApplication = errors.New("invalid application")