crossplane

Форк
0
/
.golangci.yml 
215 строк · 6.6 Кб
1
run:
2
  timeout: 10m
3

4
  skip-files:
5
  - "zz_generated\\..+\\.go$"
6

7
output:
8
  # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
9
  format: colored-line-number
10

11
linters-settings:
12
  errcheck:
13
    # report about not checking of errors in type assetions: `a := b.(MyStruct)`;
14
    # default is false: such cases aren't reported by default.
15
    check-type-assertions: false
16

17
    # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
18
    # default is false: such cases aren't reported by default.
19
    check-blank: false
20

21
    # [deprecated] comma-separated list of pairs of the form pkg:regex
22
    # the regex is used to ignore names within pkg. (default "fmt:.*").
23
    # see https://github.com/kisielk/errcheck#the-deprecated-method for details
24
    ignore: fmt:.*,io/ioutil:^Read.*
25

26
  govet:
27
    # report about shadowed variables
28
    check-shadowing: false
29

30
  gofmt:
31
    # simplify code: gofmt with `-s` option, true by default
32
    simplify: true
33

34
  gci:
35
    custom-order: true
36
    sections:
37
      - standard
38
      - default
39
      - prefix(github.com/crossplane/crossplane-runtime)
40
      - prefix(github.com/crossplane/crossplane)
41
      - blank
42
      - dot
43

44
  gocyclo:
45
    # minimal code complexity to report, 30 by default (but we recommend 10-20)
46
    min-complexity: 10
47

48
  maligned:
49
    # print struct with more effective memory layout or not, false by default
50
    suggest-new: true
51

52
  dupl:
53
    # tokens count to trigger issue, 150 by default
54
    threshold: 100
55

56
  goconst:
57
    # minimal length of string constant, 3 by default
58
    min-len: 3
59
    # minimal occurrences count to trigger, 3 by default
60
    min-occurrences: 5
61

62
  lll:
63
    # tab width in spaces. Default to 1.
64
    tab-width: 1
65

66
  unused:
67
    # treat code as a program (not a library) and report unused exported identifiers; default is false.
68
    # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
69
    # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
70
    # with golangci-lint call it on a directory with the changed file.
71
    check-exported: false
72

73
  unparam:
74
    # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
75
    # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
76
    # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
77
    # with golangci-lint call it on a directory with the changed file.
78
    check-exported: false
79

80
  nakedret:
81
    # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
82
    max-func-lines: 30
83

84
  prealloc:
85
    # XXX: we don't recommend using this linter before doing performance profiling.
86
    # For most programs usage of prealloc will be a premature optimization.
87

88
    # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
89
    # True by default.
90
    simple: true
91
    range-loops: true # Report preallocation suggestions on range loops, true by default
92
    for-loops: false # Report preallocation suggestions on for loops, false by default
93

94
  gocritic:
95
    # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
96
    # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
97
    enabled-tags:
98
      - performance
99

100
    settings: # settings passed to gocritic
101
      captLocal: # must be valid enabled check name
102
        paramsOnly: true
103
      rangeValCopy:
104
        sizeThreshold: 32
105

106
  nolintlint:
107
    require-explanation: true
108
    require-specific: true
109

110

111
linters:
112
  enable:
113
    - megacheck
114
    - govet
115
    - gocyclo
116
    - gocritic
117
    - goconst
118
    - gci
119
    - gofmt  # We enable this as well as goimports for its simplify mode.
120
    - prealloc
121
    - revive
122
    - unconvert
123
    - misspell
124
    - nakedret
125
    - nolintlint
126
  
127
  disable:
128
    # These linters are all deprecated as of golangci-lint v1.49.0. We disable
129
    # them explicitly to avoid the linter logging deprecation warnings.
130
    - deadcode
131
    - varcheck
132
    - scopelint
133
    - structcheck
134
    - interfacer
135

136
  presets:
137
    - bugs
138
    - unused
139
  fast: false
140

141

142
issues:
143
  # Excluding configuration per-path and per-linter
144
  exclude-rules:
145
    # Exclude some linters from running on tests files.
146
    - path: _test(ing)?\.go
147
      linters:
148
        - gocyclo
149
        - errcheck
150
        - dupl
151
        - gosec
152
        - scopelint
153
        - unparam
154

155
    # Ease some gocritic warnings on test files.
156
    - path: _test\.go
157
      text: "(unnamedResult|exitAfterDefer)"
158
      linters:
159
        - gocritic
160

161
    # These are performance optimisations rather than style issues per se.
162
    # They warn when function arguments or range values copy a lot of memory
163
    # rather than using a pointer.
164
    - text: "(hugeParam|rangeValCopy):"
165
      linters:
166
      - gocritic
167

168
    # This "TestMain should call os.Exit to set exit code" warning is not clever
169
    # enough to notice that we call a helper method that calls os.Exit.
170
    - text: "SA3000:"
171
      linters:
172
      - staticcheck
173

174
    - text: "k8s.io/api/core/v1"
175
      linters:
176
      - goimports
177

178
    # This is a "potential hardcoded credentials" warning. It's triggered by
179
    # any variable with 'secret' in the same, and thus hits a lot of false
180
    # positives in Kubernetes land where a Secret is an object type.
181
    - text: "G101:"
182
      linters:
183
      - gosec
184
      - gas
185

186
    # This is an 'errors unhandled' warning that duplicates errcheck.
187
    - text: "G104:"
188
      linters:
189
      - gosec
190
      - gas
191
    
192
    # Some k8s dependencies do not have JSON tags on all fields in structs.
193
    - path: k8s.io/
194
      linters:
195
      - musttag
196

197
  # Independently from option `exclude` we use default exclude patterns,
198
  # it can be disabled by this option. To list all
199
  # excluded by default patterns execute `golangci-lint run --help`.
200
  # Default value for this option is true.
201
  exclude-use-default: false
202

203
  # Show only new issues: if there are unstaged changes or untracked files,
204
  # only those changes are analyzed, else only changes in HEAD~ are analyzed.
205
  # It's a super-useful option for integration of golangci-lint into existing
206
  # large codebase. It's not practical to fix all existing issues at the moment
207
  # of integration: much better don't allow issues in new code.
208
  # Default is false.
209
  new: false
210

211
  # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
212
  max-per-linter: 0
213

214
  # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
215
  max-same-issues: 0
216

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.