Skip to content

Commit

Permalink
upgrade golangci-lint, fixes those lint failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldonhull committed Jul 18, 2024
1 parent 02b00e9 commit 0afcaae
Showing 1 changed file with 55 additions and 65 deletions.
120 changes: 55 additions & 65 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
---
output:
format: tab
formats:
- format: tab
linters-settings:
misspell:
locale: US
gomnd:
settings:
mnd:
checks: [argument, case, condition, return]
ignored-functions: strconv.ParseFloat,rsa.GenerateKey

nolintlint:
allow-unused: false
allow-leading-space: true
allow-no-explanation: []
require-explanation: true
require-specific: true
gofumpt:
lang-version: '1.18'
extra-rules: true
godox:
keywords:
Expand All @@ -33,45 +28,45 @@ linters-settings:
- ^[ ]*@
capital: true
depguard:
list-type: blacklist
include-go-root: true
includeGoStdLib: true
packages:
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: logging is allowed only by zerolog. Please use zerolog
- io/ioutil: 'io/ioutil was deprecated in Go 1.16: https://tip.golang.org/doc/go1.16'
gomodguard:
blocked:
modules:
- github.com/sirupsen/logrus:
recommendations:
- internal/logging
reason: logging is allowed only by zerolog. Please use zerolog
local_replace_directives: false
rules:
main:
deny:
- pkg: 'github.com/sirupsen/logrus'
desc: use zerolog
- pkg: log
desc: use zerolog
- pkg: 'github.com/pkg/errors'
desc: Should be replaced by standard lib errors package

# gomodguard:
# blocked:
# modules:
# - github.com/sirupsen/logrus:
# recommendations:
# - internal/logging
# reason: logging is allowed only by zerolog. Please use zerolog
# local_replace_directives: false
tagliatelle:
case:
use-field-name: true
rules:
json: camel # CUSTOMIZED: preexisting format, leave. 2022-10-27 - sheldon
yaml: camel # CUSTOMIZED: preexisting format, leave. 2022-10-27 - sheldon
json: snake
yaml: kebab
xml: camel
bson: camel
avro: snake
mapstructure: kebab
errcheck:
check-type-assertions: true
check-blank: false
ignore: fmt:.*,io/ioutil:^Read.*
exclude-functions:
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
- io.Closer.Close
- io.Closer.Body.Close
errcheck:
check-type-assertions: true
check-blank: false
exclude-functions:
- io/ioutil.ReadFile
- io.Copy(*bytes.Buffer)
- io.Copy(os.Stdout)
- io.Closer.Close
- io.Closer.Body.Close
govet:
enable-all: true
check-shadowing: true
disable:
- fieldalignment
settings:
Expand Down Expand Up @@ -99,22 +94,22 @@ linters-settings:
- ok
- zl
- fs
disable:
- fieldalignment

revive:
ignore-generated-header: true
enableAllRules: true
exclude:
- .*_test.go
enable-all-rules: true
rules:
- name: var-naming
severity: error
# ireturn:
# allow:
# - github.com\/mitchellh\/cli # CUSTOMIZED: cli command is common interfacer in this project
- name: line-length-limit
severity: warning
arguments:
- 400
- name: function-length
severity: warning
arguments: [20, 5000]

linters:
exclude-use-default: false
enable-all: true
disable:
- scopelint
Expand Down Expand Up @@ -147,21 +142,12 @@ linters:
- rowserrcheck # disabled due to generics, can enable in future if needed
- sqlclosecheck # disabled due to generics, can enable in future if needed
- wastedassign # disabled due to generics, can enable in future if needed
- funlen #OVERRIDE: ok using for bot, lots of quick long commands i worked on
- cyclop #OVERRIDE: ok using for bot, lots of quick long commands i worked on
- gocognit #OVERRIDE: ok using for bot, lots of quick long commands i worked on

- funlen # CUSTOMIZED: preexisting many larger functions, remove to avoid excessive noise, leave. 2022-10-27 - sheldon
- cyclop # CUSTOMIZED: preexisting many larger functions, remove to avoid excessive noise, leave. 2022-10-27 - sheldon
- gocognit # CUSTOMIZED: preexisting many larger functions, remove to avoid excessive noise, leave. 2022-10-27 - sheldon
- testpackage # CUSTOMIZED: existing tests don't use this approach, too many false positives, remove to avoid excessive noise, leave. 2022-10-27 - sheldon
- ireturn # CUSTOMIZED: used in this project with cli calls a lot, leave. 2022-10-27 - sheldon
run:
skip-dirs-use-default: true
skip-dirs:
- build
- artifacts
- _tools
- vendor
- vendor$
- tests/fake
timeout: 5m
build-tags:
- mage
- tools
Expand All @@ -182,7 +168,7 @@ issues:
- linters:
- goerr113
text: do not define dynamic errors
- path: magefiles/*
- path: magefiles
linters:
- goerr113
- wrapcheck
Expand All @@ -193,7 +179,6 @@ issues:
- maintidx
- deadcode
- gochecknoglobals
- unused
- path: magefile.go
linters:
- goerr113
Expand All @@ -216,8 +201,13 @@ issues:
linters:
- godot
text: mocked files do not need to be checked
- path: commands/ # CUSTOMIZED: current cli framework uses this return of functions so not checking those
text: current cli framework uses this return of functions so not checking those
linters:
- ireturn
whole-files: false
exclude-dirs:
- build
- .artifacts
- .cache
- artifacts
- .trunk
- _tools
- vendor
- vendor$

0 comments on commit 0afcaae

Please sign in to comment.