From 1c5b30b90104c979f2dcfe683015f6ed5ef609d3 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Tue, 20 Aug 2024 20:46:26 -0500 Subject: [PATCH] .golangci.yml: update rules --- .golangci.yml | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index fa06d0880..824bcbe72 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -16,6 +16,9 @@ linters: - whitespace - depguard - containedctx + - fatcontext + - mirror + - loggercheck linters-settings: exhaustive: default-signifies-exhaustive: true @@ -31,8 +34,21 @@ linters-settings: # - G304 # - G404 govet: - # report about shadowed variables - check-shadowing: true + enable: + - shadow + settings: + printf: + # Additionally check custom logger + funcs: + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Debugf + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Infof + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Warnf + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Errorf + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Panicf + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Fatalf + - (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).AssumptionViolationf + - (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Tracef + - (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Criticalf errorlint: # Allow formatting of errors without %w errorf: false @@ -111,6 +127,21 @@ linters-settings: desc: Use gopkg.in/guregu/null.v4 instead - pkg: "gopkg.in/guregu/null.v3" desc: Use gopkg.in/guregu/null.v4 instead + - pkg: github.com/go-gorm/gorm + desc: Use github.com/jmoiron/sqlx directly instead + loggercheck: + # Check that *w logging functions have even number of args (i.e., well formed key-value pairs). + rules: + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Debugw + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Infow + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Warnw + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Errorw + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Panicw + - (github.com/smartcontractkit/chainlink-common/pkg/logger.Logger).Fatalw + - (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).AssumptionViolationw + - (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Tracew + - (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).Criticalw + - (github.com/smartcontractkit/chainlink-common/pkg/logger.SugaredLogger).With issues: exclude-rules: - path: test