aboutsummaryrefslogtreecommitdiff
path: root/.golangci.yaml
blob: 232fb42e983019dfff6659d49c7dcbcb2dcf395a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead.                                            #
################################################################################

run:
  deadline: 3m # 1m by default
  modules-download-mode: readonly

output:
  # Do not print lines of code with issue.
  print-issued-lines: false

issues:
  exclude:
    # It is idiomatic Go to reuse the name 'err' with ':=' for subsequent errors.
    # Ref: https://go.dev/doc/effective_go#redeclaration
    - 'declaration of "err" shadows declaration at'
  exclude-rules:
    - path: _test\.go
      linters:
        - bodyclose
  # '0' disables the following options.
  max-issues-per-linter: 0
  max-same-issues: 0

linters-settings:
  dupl:
    # Tokens count to trigger issue, 150 by default.
    threshold: 100
  errcheck:
    # Report about assignment of errors to blank identifier.
    check-blank: true
    # Report about not checking of errors in type assertions.
    check-type-assertions: true
  forbidigo:
    forbid:
      # ioutil package has been deprecated: https://github.com/golang/go/issues/42026
      - ^ioutil\..*$
      # Using http.DefaultServeMux is discouraged because it's a global variable that some packages silently and magically add handlers to (esp. net/http/pprof).
      # Applications wishing to use http.ServeMux should obtain local instances through http.NewServeMux() instead of using the global default instance.
      - ^http.DefaultServeMux$
      - ^http.Handle(?:Func)?$
  gocritic:
    enabled-checks:
      - boolExprSimplify
      - builtinShadow
      - emptyStringTest
      - evalOrder
      - httpNoBody
      - importShadow
      - initClause
      - methodExprCall
      - paramTypeCombine
      - preferFilepathJoin
      - ptrToRefParam
      - redundantSprint
      - returnAfterHttpError
      - stringConcatSimplify
      - timeExprSimplify
      - truncateCmp
      - typeAssertChain
      - typeUnparen
      - unnamedResult
      - unnecessaryBlock
      - unnecessaryDefer
      - weakCond
      - yodaStyleExpr
  goimports:
    # Put local imports after 3rd-party packages.
    local-prefixes: github.com/majewsky/schwift
  gosec:
    excludes:
      # gosec wants us to set a short ReadHeaderTimeout to avoid Slowloris attacks, but doing so would expose us to Keep-Alive race conditions (see https://iximiuz.com/en/posts/reverse-proxy-http-keep-alive-and-502s/)
      - G112
      # created file permissions are restricted by umask if necessary
      - G306
  govet:
    # Report about shadowed variables.
    check-shadowing: true
  nolintlint:
    require-specific: true
  stylecheck:
    dot-import-whitelist:
      - github.com/onsi/ginkgo/v2
      - github.com/onsi/gomega
  usestdlibvars:
    constant-kind: true
    crypto-hash: true
    default-rpc-path: true
    http-method: true
    http-status-code: true
    os-dev-null: true
    rpc-default-path: true
    time-weekday: true
    time-month: true
    time-layout: true
    tls-signature-scheme: true
  whitespace:
    # Enforce newlines (or comments) after multi-line function signatures.
    multi-func: true

linters:
  # We use 'disable-all' and enable linters explicitly so that a newer version
  # does not introduce new linters unexpectedly.
  disable-all: true
  enable:
    - bodyclose
    - containedctx
    - dupl
    - dupword
    - durationcheck
    - errcheck
    - errorlint
    - exportloopref
    - forbidigo
    - ginkgolinter
    - gocheckcompilerdirectives
    - gocritic
    - gofmt
    - goimports
    - gosec
    - gosimple
    - govet
    - ineffassign
    - misspell
    - noctx
    - nolintlint
    - nosprintfhostport
    - rowserrcheck
    - sqlclosecheck
    - staticcheck
    - stylecheck
    - tenv
    - typecheck
    - unconvert
    - unparam
    - unused
    - usestdlibvars
    - whitespace