|
| 1 | +version: "2" |
| 2 | + |
1 | 3 | output: |
2 | 4 | formats: |
3 | | - - format: colored-line-number |
4 | | - |
5 | | -linters-settings: |
6 | | - errcheck: |
7 | | - # report about not checking of errors in type assetions: `a := b.(MyStruct)`; |
8 | | - # default is false: such cases aren't reported by default. |
9 | | - check-type-assertions: false |
10 | | - |
11 | | - # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; |
12 | | - # default is false: such cases aren't reported by default. |
13 | | - check-blank: false |
14 | | - |
15 | | - |
16 | | - govet: |
17 | | - # report about shadowed variables |
18 | | - disable: |
19 | | - - shadow |
20 | | - |
21 | | - gofmt: |
22 | | - # simplify code: gofmt with `-s` option, true by default |
23 | | - simplify: true |
24 | | - |
25 | | - goimports: |
26 | | - # put imports beginning with prefix after 3rd-party packages; |
27 | | - # it's a comma-separated list of prefixes |
28 | | - local-prefixes: github.com/upbound/upjet-provider-template |
29 | | - |
30 | | - gocyclo: |
31 | | - # minimal code complexity to report, 30 by default (but we recommend 10-20) |
32 | | - min-complexity: 10 |
33 | | - |
34 | | - dupl: |
35 | | - # tokens count to trigger issue, 150 by default |
36 | | - threshold: 100 |
37 | | - |
38 | | - goconst: |
39 | | - # minimal length of string constant, 3 by default |
40 | | - min-len: 3 |
41 | | - # minimal occurrences count to trigger, 3 by default |
42 | | - min-occurrences: 5 |
43 | | - |
44 | | - lll: |
45 | | - # tab width in spaces. Default to 1. |
46 | | - tab-width: 1 |
47 | | - |
48 | | - unparam: |
49 | | - # Inspect exported functions, default is false. Set to true if no external program/library imports your code. |
50 | | - # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: |
51 | | - # if it's called for subdir of a project it can't find external interfaces. All text editor integrations |
52 | | - # with golangci-lint call it on a directory with the changed file. |
53 | | - check-exported: false |
54 | | - |
55 | | - nakedret: |
56 | | - # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
57 | | - max-func-lines: 30 |
58 | | - |
59 | | - prealloc: |
60 | | - # XXX: we don't recommend using this linter before doing performance profiling. |
61 | | - # For most programs usage of prealloc will be a premature optimization. |
62 | | - |
63 | | - # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. |
64 | | - # True by default. |
65 | | - simple: true |
66 | | - range-loops: true # Report preallocation suggestions on range loops, true by default |
67 | | - for-loops: false # Report preallocation suggestions on for loops, false by default |
68 | | - |
69 | | - gocritic: |
70 | | - # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. |
71 | | - # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". |
72 | | - enabled-tags: |
73 | | - - performance |
74 | | - |
75 | | - settings: # settings passed to gocritic |
76 | | - captLocal: # must be valid enabled check name |
77 | | - paramsOnly: true |
78 | | - rangeValCopy: |
79 | | - sizeThreshold: 32 |
| 5 | + text: |
| 6 | + colors: true |
| 7 | + |
| 8 | +formatters: |
| 9 | + enable: |
| 10 | + - gofmt # We enable this as well as goimports for its simplify mode. |
| 11 | + - goimports |
| 12 | + |
| 13 | + settings: |
| 14 | + goimports: |
| 15 | + # put imports beginning with prefix after 3rd-party packages; |
| 16 | + # it's a comma-separated list of prefixes |
| 17 | + local-prefixes: |
| 18 | + - github.com/upbound/upjet-provider-template |
| 19 | + |
| 20 | + gofmt: |
| 21 | + # simplify code: gofmt with `-s` option, true by default |
| 22 | + simplify: true |
80 | 23 |
|
81 | 24 | linters: |
| 25 | + exclusions: |
| 26 | + paths: |
| 27 | + - "zz_\\..+\\.go$" |
| 28 | + rules: |
| 29 | + # Exclude some linters from running on tests files. |
| 30 | + - path: _test(ing)?\.go |
| 31 | + linters: |
| 32 | + - gocyclo |
| 33 | + - errcheck |
| 34 | + - dupl |
| 35 | + - gosec |
| 36 | + - scopelint |
| 37 | + - unparam |
| 38 | + |
| 39 | + # Ease some gocritic warnings on test files. |
| 40 | + - path: _test\.go |
| 41 | + text: "(unnamedResult|exitAfterDefer)" |
| 42 | + linters: |
| 43 | + - gocritic |
| 44 | + |
| 45 | + # These are performance optimisations rather than style issues per se. |
| 46 | + # They warn when function arguments or range values copy a lot of memory |
| 47 | + # rather than using a pointer. |
| 48 | + - text: "(hugeParam|rangeValCopy):" |
| 49 | + linters: |
| 50 | + - gocritic |
| 51 | + |
| 52 | + # This "TestMain should call os.Exit to set exit code" warning is not clever |
| 53 | + # enough to notice that we call a helper method that calls os.Exit. |
| 54 | + - text: "SA3000:" |
| 55 | + linters: |
| 56 | + - staticcheck |
| 57 | + |
| 58 | + - text: "k8s.io/api/core/v1" |
| 59 | + linters: |
| 60 | + - goimports |
| 61 | + |
| 62 | + # This is a "potential hardcoded credentials" warning. It's triggered by |
| 63 | + # any variable with 'secret' in the same, and thus hits a lot of false |
| 64 | + # positives in Kubernetes land where a Secret is an object type. |
| 65 | + - text: "G101:" |
| 66 | + linters: |
| 67 | + - gosec |
| 68 | + - gas |
| 69 | + |
| 70 | + # This is an 'errors unhandled' warning that duplicates errcheck. |
| 71 | + - text: "G104:" |
| 72 | + linters: |
| 73 | + - gosec |
| 74 | + - gas |
| 75 | + |
| 76 | + default: none |
82 | 77 | enable: |
83 | | - - gosimple |
84 | 78 | - staticcheck |
85 | 79 | - unused |
86 | 80 | - govet |
87 | 81 | - gocyclo |
88 | 82 | - gocritic |
89 | 83 | - goconst |
90 | | - - goimports |
91 | | - - gofmt # We enable this as well as goimports for its simplify mode. |
92 | 84 | - prealloc |
93 | 85 | - revive |
94 | 86 | - unconvert |
95 | 87 | - misspell |
96 | 88 | - nakedret |
97 | 89 |
|
98 | | - presets: |
99 | | - - bugs |
100 | | - - unused |
101 | | - fast: false |
102 | | - |
| 90 | + settings: |
| 91 | + errcheck: |
| 92 | + # report about not checking of errors in type assetions: `a := b.(MyStruct)`; |
| 93 | + # default is false: such cases aren't reported by default. |
| 94 | + check-type-assertions: false |
| 95 | + |
| 96 | + # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`; |
| 97 | + # default is false: such cases aren't reported by default. |
| 98 | + check-blank: false |
| 99 | + |
| 100 | + govet: |
| 101 | + # report about shadowed variables |
| 102 | + disable: |
| 103 | + - shadow |
| 104 | + |
| 105 | + gocyclo: |
| 106 | + # minimal code complexity to report, 30 by default (but we recommend 10-20) |
| 107 | + min-complexity: 10 |
| 108 | + |
| 109 | + dupl: |
| 110 | + # tokens count to trigger issue, 150 by default |
| 111 | + threshold: 100 |
| 112 | + |
| 113 | + goconst: |
| 114 | + # minimal length of string constant, 3 by default |
| 115 | + min-len: 3 |
| 116 | + # minimal occurrences count to trigger, 3 by default |
| 117 | + min-occurrences: 5 |
| 118 | + |
| 119 | + lll: |
| 120 | + # tab width in spaces. Default to 1. |
| 121 | + tab-width: 1 |
| 122 | + |
| 123 | + unparam: |
| 124 | + # Inspect exported functions, default is false. Set to true if no external program/library imports your code. |
| 125 | + # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors: |
| 126 | + # if it's called for subdir of a project it can't find external interfaces. All text editor integrations |
| 127 | + # with golangci-lint call it on a directory with the changed file. |
| 128 | + check-exported: false |
| 129 | + |
| 130 | + nakedret: |
| 131 | + # make an issue if func has more lines of code than this setting and it has naked returns; default is 30 |
| 132 | + max-func-lines: 30 |
| 133 | + |
| 134 | + prealloc: |
| 135 | + # XXX: we don't recommend using this linter before doing performance profiling. |
| 136 | + # For most programs usage of prealloc will be a premature optimization. |
| 137 | + |
| 138 | + # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them. |
| 139 | + # True by default. |
| 140 | + simple: true |
| 141 | + range-loops: true # Report preallocation suggestions on range loops, true by default |
| 142 | + for-loops: false # Report preallocation suggestions on for loops, false by default |
| 143 | + |
| 144 | + gocritic: |
| 145 | + # Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks. |
| 146 | + # Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags". |
| 147 | + enabled-tags: |
| 148 | + - performance |
| 149 | + |
| 150 | + settings: # settings passed to gocritic |
| 151 | + captLocal: # must be valid enabled check name |
| 152 | + paramsOnly: true |
| 153 | + rangeValCopy: |
| 154 | + sizeThreshold: 32 |
| 155 | + |
| 156 | + revive: |
| 157 | + rules: |
| 158 | + - name: package-comments |
| 159 | + disabled: true |
103 | 160 |
|
104 | 161 | issues: |
105 | | - exclude-files: |
106 | | - - "zz_\\..+\\.go$" |
107 | | - # Excluding configuration per-path and per-linter |
108 | | - exclude-rules: |
109 | | - # Exclude some linters from running on tests files. |
110 | | - - path: _test(ing)?\.go |
111 | | - linters: |
112 | | - - gocyclo |
113 | | - - errcheck |
114 | | - - dupl |
115 | | - - gosec |
116 | | - - scopelint |
117 | | - - unparam |
118 | | - |
119 | | - # Ease some gocritic warnings on test files. |
120 | | - - path: _test\.go |
121 | | - text: "(unnamedResult|exitAfterDefer)" |
122 | | - linters: |
123 | | - - gocritic |
124 | | - |
125 | | - # These are performance optimisations rather than style issues per se. |
126 | | - # They warn when function arguments or range values copy a lot of memory |
127 | | - # rather than using a pointer. |
128 | | - - text: "(hugeParam|rangeValCopy):" |
129 | | - linters: |
130 | | - - gocritic |
131 | | - |
132 | | - # This "TestMain should call os.Exit to set exit code" warning is not clever |
133 | | - # enough to notice that we call a helper method that calls os.Exit. |
134 | | - - text: "SA3000:" |
135 | | - linters: |
136 | | - - staticcheck |
137 | | - |
138 | | - - text: "k8s.io/api/core/v1" |
139 | | - linters: |
140 | | - - goimports |
141 | | - |
142 | | - # This is a "potential hardcoded credentials" warning. It's triggered by |
143 | | - # any variable with 'secret' in the same, and thus hits a lot of false |
144 | | - # positives in Kubernetes land where a Secret is an object type. |
145 | | - - text: "G101:" |
146 | | - linters: |
147 | | - - gosec |
148 | | - - gas |
149 | | - |
150 | | - # This is an 'errors unhandled' warning that duplicates errcheck. |
151 | | - - text: "G104:" |
152 | | - linters: |
153 | | - - gosec |
154 | | - - gas |
155 | 162 |
|
156 | 163 | # Show only new issues: if there are unstaged changes or untracked files, |
157 | 164 | # only those changes are analyzed, else only changes in HEAD~ are analyzed. |
|
0 commit comments