|
1 | | -output: |
2 | | - # Make output more digestible with quickfix in vim/emacs/etc. |
3 | | - sort-results: true |
4 | | - print-issued-lines: false |
| 1 | +version: "2" |
| 2 | + |
| 3 | +issues: |
| 4 | + # Print all issues reported by all linters. |
| 5 | + max-issues-per-linter: 0 |
| 6 | + max-same-issues: 0 |
5 | 7 |
|
6 | 8 | linters: |
7 | 9 | # We'll track the golangci-lint default linters manually |
8 | 10 | # instead of letting them change without our control. |
9 | | - disable-all: true |
| 11 | + default: none |
10 | 12 | enable: |
11 | 13 | # golangci-lint defaults: |
12 | | - - gosimple |
13 | 14 | - govet |
14 | 15 | - ineffassign |
15 | 16 | - staticcheck |
16 | 17 | - unused |
17 | 18 |
|
18 | 19 | # Our own extras: |
19 | | - - gofumpt |
20 | | - - nolintlint # lints nolint directives |
21 | | - - revive |
22 | 20 | - errorlint |
| 21 | + - nolintlint # lints //nolint directives |
| 22 | + - revive |
23 | 23 |
|
24 | 24 | # License header check: |
25 | 25 | - goheader |
26 | 26 |
|
27 | | -linters-settings: |
28 | | - govet: |
29 | | - # These govet checks are disabled by default, but they're useful. |
30 | | - enable: |
31 | | - - nilness |
32 | | - - reflectvaluecompare |
33 | | - - sortslice |
34 | | - - unusedwrite |
35 | | - |
36 | | - goheader: |
37 | | - values: |
38 | | - const: |
39 | | - COMPANY: 'Uber Technologies, Inc.' |
40 | | - regexp: |
41 | | - YEAR_RANGE: '\d{4}(-\d{4})?' |
42 | | - template: |- |
43 | | - Copyright (c) {{ YEAR_RANGE }} {{ COMPANY }} |
| 27 | + settings: |
44 | 28 |
|
45 | | - Permission is hereby granted, free of charge, to any person obtaining a copy |
46 | | - of this software and associated documentation files (the "Software"), to deal |
47 | | - in the Software without restriction, including without limitation the rights |
48 | | - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
49 | | - copies of the Software, and to permit persons to whom the Software is |
50 | | - furnished to do so, subject to the following conditions: |
| 29 | + # These govet checks are disabled by default, but they're useful. |
| 30 | + govet: |
| 31 | + enable: |
| 32 | + - nilness |
| 33 | + - reflectvaluecompare |
| 34 | + - sortslice |
| 35 | + - unusedwrite |
51 | 36 |
|
52 | | - The above copyright notice and this permission notice shall be included in |
53 | | - all copies or substantial portions of the Software. |
| 37 | + goheader: |
| 38 | + values: |
| 39 | + const: |
| 40 | + COMPANY: Uber Technologies, Inc. |
| 41 | + regexp: |
| 42 | + YEAR_RANGE: \d{4}(-\d{4})? |
| 43 | + template: |- |
| 44 | + Copyright (c) {{ YEAR_RANGE }} {{ COMPANY }} |
54 | 45 |
|
55 | | - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
56 | | - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
57 | | - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
58 | | - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
59 | | - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
60 | | - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
61 | | - THE SOFTWARE. |
| 46 | + Permission is hereby granted, free of charge, to any person obtaining a copy |
| 47 | + of this software and associated documentation files (the "Software"), to deal |
| 48 | + in the Software without restriction, including without limitation the rights |
| 49 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 50 | + copies of the Software, and to permit persons to whom the Software is |
| 51 | + furnished to do so, subject to the following conditions: |
62 | 52 |
|
| 53 | + The above copyright notice and this permission notice shall be included in |
| 54 | + all copies or substantial portions of the Software. |
63 | 55 |
|
64 | | -issues: |
65 | | - # Print all issues reported by all linters. |
66 | | - max-issues-per-linter: 0 |
67 | | - max-same-issues: 0 |
| 56 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 57 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 58 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 59 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 60 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 61 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 62 | + THE SOFTWARE. |
68 | 63 |
|
69 | | - # Don't ignore some of the issues that golangci-lint considers okay. |
70 | | - # This includes documenting all exported entities. |
71 | | - exclude-use-default: false |
| 64 | + exclusions: |
| 65 | + generated: lax |
| 66 | + rules: |
| 67 | + # Don't warn on unused parameters. |
| 68 | + # Parameter names are useful; replacing them with '_' is undesirable. |
| 69 | + - linters: [revive] |
| 70 | + text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _' |
72 | 71 |
|
73 | | - exclude-rules: |
74 | | - # Don't warn on unused parameters. |
75 | | - # Parameter names are useful; replacing them with '_' is undesirable. |
76 | | - - linters: [revive] |
77 | | - text: 'unused-parameter: parameter \S+ seems to be unused, consider removing or renaming it as _' |
| 72 | + # staticcheck already has smarter checks for empty blocks. |
| 73 | + # revive's empty-block linter has false positives. |
| 74 | + # For example, as of writing this, the following is not allowed. |
| 75 | + # for foo() { } |
| 76 | + - linters: [revive] |
| 77 | + text: 'empty-block: this block is empty, you can remove it' |
78 | 78 |
|
79 | | - # staticcheck already has smarter checks for empty blocks. |
80 | | - # revive's empty-block linter has false positives. |
81 | | - # For example, as of writing this, the following is not allowed. |
82 | | - # for foo() { } |
83 | | - - linters: [revive] |
84 | | - text: 'empty-block: this block is empty, you can remove it' |
| 79 | + # It's okay if internal packages and examples in docs/ |
| 80 | + # don't have package comments. |
| 81 | + - linters: [revive] |
| 82 | + path: .+/internal/.+|^internal/.+|^docs/.+ |
| 83 | + text: should have a package comment |
85 | 84 |
|
86 | | - # It's okay if internal packages and examples in docs/ |
87 | | - # don't have package comments. |
88 | | - - linters: [revive] |
89 | | - path: '.+/internal/.+|^internal/.+|^docs/.+' |
90 | | - text: 'should have a package comment' |
| 85 | + # It's okay for tests to use dot imports. |
| 86 | + - linters: [revive] |
| 87 | + path: _test\.go$ |
| 88 | + text: should not use dot imports |
91 | 89 |
|
92 | | - # It's okay for tests to use dot imports. |
93 | | - - linters: [revive] |
94 | | - path: '_test\.go$' |
95 | | - text: 'should not use dot imports' |
| 90 | +formatters: |
| 91 | + enable: [gofumpt] |
| 92 | + exclusions: |
| 93 | + generated: lax |
0 commit comments