Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
201 changes: 80 additions & 121 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,120 +1,7 @@
linters-settings:
funlen:
lines: 350
statements: 135
depguard:
list-type: blacklist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
dupl:
threshold: 100
errorlint:
# Check whether fmt.Errorf uses the %w verb for formatting errors.
# See the https://github.com/polyfloyd/go-errorlint for caveats.
# Default: true
errorf: false
# Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true)
# Default: true
errorf-multi: true
# Check for plain type assertions and type switches.
# Default: true
asserts: true
# Check for plain error comparisons.
# Default: true
comparison: true
exhaustive:
# Program elements to check for exhaustiveness.
# Default: [ switch ]
check:
- switch
- map
# Check switch statements in generated files also.
# Default: false
check-generated: true
# Presence of "default" case in switch statements satisfies exhaustiveness,
# even if all enum members are not listed.
# Default: false
default-signifies-exhaustive: true
# Enum members matching the supplied regex do not have to be listed in
# switch statements to satisfy exhaustiveness.
# Default: ""
ignore-enum-members: "Example.+"
# Enum types matching the supplied regex do not have to be listed in
# switch statements to satisfy exhaustiveness.
# Default: ""
ignore-enum-types: "Example.+"
# Consider enums only in package scopes, not in inner scopes.
# Default: false
package-scope-only: true
# Only run exhaustive check on switches with "//exhaustive:enforce" comment.
# Default: false
explicit-exhaustive-switch: false
# Only run exhaustive check on map literals with "//exhaustive:enforce" comment.
# Default: false
explicit-exhaustive-map: false
gci:
local-prefixes: github.com/datatrails/go-datatrails-merklelog
goconst:
min-len: 2
min-occurrences: 2
gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- wrapperFunc
gocognit:
min-complexity: 75
gocyclo:
min-complexity: 10
goimports:
local-prefixes: github.com/golangci/golangci-lint
golint:
min-confidence: 0
govet:
check-shadowing: true
settings:
printf:
funcs:
- Infof
- Warnf
- Errorf
- Fatalf
lll:
line-length: 500
maligned:
suggest-new: true
misspell:
locale: UK
run:
timeout: 5m
build-tags: "golangcilint unit integration e2e azurite"

# depguard (control upstream repos) not needed
# dupl - see ticket #3095
# funlen - it is to anoying for test code and this sort of subjective judgement is what PR reviews are for
# exhaustive - see ticket #3096
# gci - disabled as confusing and not really useful
# gochecknoglobals - not really useful
# goconst - see ticket #3097
# goerr113 - disabled see https://github.com/Djarvur/go-err113/issues/10
# gofumpt - not useful - confusing messages
# gomnd - see ticket #3116
# govet - see ticket #3117
# nilreturn onwardis not yet evaluated...
# maligned - this guards against performance issues due to accessing
# mis-aligned structs. We don't have direct evidence of this being a
# real problem for us. We use a lot of generated code in our hot
# paths anyway (we have no control over there layout). Until we get
# direct evidence this is hurting us, we prefer our stucts layed out
# logically and don't want to have to nolint tag everything.
#
# misspell - expected UK spelling with misspell, but customer facing text needs to be US.
# tagalign - suppress until we can get a golang code formatter that will fix this (cosmetic)
#
# WARN: typecheck cannot be disabled as golang-ci uses it internally to detect uncompilable code.
# Unfortunately the src/azb2c package triggers this erroneously so we add it to skip-dirs below.
#
linters:
enable-all: true
disable:
Expand All @@ -132,8 +19,7 @@ linters:
- exhaustruct
- forbidigo
- forcetypeassert
# DONT re-enable funlen please
- funlen
- funlen # DONT re-enable funlen please
- gci
- gochecknoglobals
- goconst
Expand Down Expand Up @@ -192,9 +78,82 @@ linters:
- wsl
- wrapcheck

run:
build-tags:
- golangcilint
linters-settings:
funlen:
lines: 350
statements: 135

depguard:
list-type: blacklist
packages:
- github.com/sirupsen/logrus # only allowed in logutils

dupl:
threshold: 100

errorlint:
errorf: false
errorf-multi: true
asserts: true
comparison: true

exhaustive:
check:
- switch
- map
check-generated: true
default-signifies-exhaustive: true
ignore-enum-members: "Example.+"
ignore-enum-types: "Example.+"
package-scope-only: true
explicit-exhaustive-switch: false
explicit-exhaustive-map: false

gci:
local-prefixes: github.com/datatrails/go-datatrails-merklelog

goconst:
min-len: 2
min-occurrences: 2

gocritic:
enabled-tags:
- performance
- style
- experimental
disabled-checks:
- wrapperFunc

gocognit:
min-complexity: 75

gocyclo:
min-complexity: 10

goimports:
local-prefixes: github.com/golangci/golangci-lint

golint:
min-confidence: 0

govet:
check-shadowing: true
settings:
printf:
funcs:
- Infof
- Warnf
- Errorf
- Fatalf

lll:
line-length: 500

maligned:
suggest-new: true

misspell:
locale: UK

issues:
exclude-rules:
Expand Down
Loading
Loading