podman/.golangci.yml
Paul Holzinger 51fbf3da9e
enable gocritic linter
The linter ensures a common code style.
- use switch/case instead of else if
- use if instead of switch/case for single case statement
- add space between comment and text
- detect the use of defer with os.Exit()
- use short form var += "..." instead of var = var + "..."
- detect problems with append()
```
newSlice := append(orgSlice, val)
```
  This could lead to nasty bugs because the orgSlice will be changed in
  place if it has enough capacity too hold the new elements. Thus we
  newSlice might not be a copy.

Of course most of the changes are just cosmetic and do not cause any
logic errors but I think it is a good idea to enforce a common style.
This should help maintainability.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2022-04-26 18:12:22 +02:00

69 lines
1.3 KiB
YAML

---
run:
concurrency: 6
deadline: 5m
skip-dirs-use-default: true
skip-dirs:
- contrib
- dependencies
skip-files:
- swagger.go
modules-download-mode: readonly
linters:
enable-all: true
disable:
# All these break for one reason or another
- nolintlint # some linter must be disabled (see `nolint` in the code)
- tagliatelle # too many JSON keys cannot be changed due to compat
- gocognit
- testpackage
- goerr113
- exhaustivestruct
- errorlint
- wrapcheck
- paralleltest
- wsl
- godox
- tparallel
- gomnd
- nlreturn
- noctx
- nestif
- predeclared
- thelper
- ifshort
- forbidigo
- exhaustive
- gofumpt
- gci
- godot
- dupl
- funlen
- gochecknoglobals
- gochecknoinits
- goconst
- gocyclo
- lll
- unconvert
- errcheck
- gosec
- maligned
- gomoddirectives
- containedctx
- contextcheck
- cyclop
- errname
- forcetypeassert
- ireturn
- varnamelen
- maintidx
- nilnil
# deprecated linters
- golint # replaced by revive
- scopelint # replaced by exportloopref
- interfacer
linters-settings:
errcheck:
check-blank: false
ignore: encoding/json:^Unmarshal,fmt:.*