Welcome to mirror list, hosted at ThFree Co, Russian Federation.

.golangci.yml - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b1359a1255181da6cfe99ade64b20b7f00f52d52 (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
# options for analysis running
run:
  # timeout for analysis, e.g. 30s, 5m, default is 1m
  timeout: 5m
  modules-download-mode: readonly

# list of useful linters could be found at https://github.com/golangci/awesome-go-linters
linters:
  disable-all: true
  enable:
    - bidichk
    - deadcode
    - errcheck
    - exportloopref
    - depguard
    - forbidigo
    - gci
    # We use both gofmt and gofumpt because gofumpt doesn't seem to be linting
    # for simplifications, while gofmt does.
    - gofmt
    - gofumpt
    - goimports
    - gosimple
    - govet
    - ineffassign
    - makezero
    - megacheck
    - misspell
    - noctx
    - nolintlint
    - revive
    - rowserrcheck
    - sqlclosecheck
    - staticcheck
    - structcheck
    - stylecheck
    - unconvert
    - unused
    - varcheck
    - wastedassign

linters-settings:
  depguard:
    list-type: blacklist
    include-go-root: true
    packages-with-error-message:
      - io/ioutil: "ioutil is deprecated starting with Go 1.16"
  forbidigo:
    forbid:
      # Tests and code which use timing-based setups have repeatedly resulted
      # in flaky tests and are considered a code smell. Tests should be
      # rewritten to use deterministic timing sources like tickers. Using the
      # following functions is thus disallowed. and a code smell.
      - ^context.WithDeadline$
      - ^context.WithTimeout$
      # Tests should always use `testhelper.Context()`: this context has
      # special handling for feature flags which allows us to assert that
      # they're tested as expected.
      - ^context.Background$
      - ^context.TODO$
  stylecheck:
    # ST1000 checks for missing package comments. We don't use these for most
    # packages, so let's disable this check.
    checks: [ "all", "-ST1000" ]

issues:
  exclude-use-default: false
  exclude-rules:
    - linters:
        - forbidigo
      # This fine thing excludes all paths which don't end with "_test.go".
      path: "^([^_]|_([^t]|t([^e]|e([^s]|s([^t]|t([^\\.]|\\.([^g]|g[^o])))))))*$"
    - linters:
        - revive
      text: "context.Context should be the first parameter of a function"
      path: "_test.go"
    - linters:
        - errcheck
      text: "Error return value of `[^`]+.(Close|Serve)` is not checked"
    - linters:
        - errcheck
      path: "cmd/gitaly-wrapper/main.go"
      text: "Error return value of `cmd.Wait` is not checked"
    - linters:
        - errcheck
      path: "internal/praefect/nodes/local_elector.go"
      text: "Error return value of `s.checkNodes` is not checked"
    - linters:
        - errcheck
      path: "internal/praefect/nodes/manager.go"
      text: "Error return value of `strategy.checkNodes` is not checked"
    - linters:
        - errcheck
      path: "internal/praefect/nodes/sql_elector.go"
      text: "Error return value of `s.checkNodes` is not checked"
    - linters:
        - errcheck
      path: "internal/middleware/limithandler/limithandler.go"
      text: "Error return value of `limiter.Limit` is not checked"
    - linters:
        - errcheck
      path: "internal/supervisor/supervisor.go"
      text: "Error return value of `(cmd.Process.Kill)?` is not checked"
    - linters:
        - errcheck
      path: "internal/gitaly/rubyserver/worker.go"
      text: "Error return value of `syscall.Kill` is not checked"
    - linters:
        - errcheck
      path: "internal/command/command.go"
      text: "Error return value of `syscall.Kill` is not checked"
  # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
  max-issues-per-linter: 0
  # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
  max-same-issues: 0