|
1 | | -# This is the configuration for golangci-lint for the restic project. |
2 | | -# |
3 | | -# A sample config with all settings is here: |
4 | | -# https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml |
5 | | - |
| 1 | +version: "2" |
6 | 2 | linters: |
7 | 3 | # only enable the linters listed below |
8 | | - disable-all: true |
| 4 | + default: none |
9 | 5 | enable: |
| 6 | + - asciicheck |
| 7 | + # ensure that http response bodies are closed |
| 8 | + - bodyclose |
| 9 | + - copyloopvar |
10 | 10 | # make sure all errors returned by functions are handled |
11 | 11 | - errcheck |
12 | | - |
13 | | - # show how code can be simplified |
14 | | - - gosimple |
15 | | - |
16 | | - # make sure code is formatted |
17 | | - - gofmt |
18 | | - |
19 | 12 | # examine code and report suspicious constructs, such as Printf calls whose |
20 | 13 | # arguments do not align with the format string |
21 | 14 | - govet |
22 | | - |
23 | | - # make sure names and comments are used according to the conventions |
24 | | - - revive |
25 | | - |
| 15 | + # consistent imports |
| 16 | + - importas |
26 | 17 | # detect when assignments to existing variables are not used |
27 | 18 | - ineffassign |
28 | | - |
| 19 | + - nolintlint |
| 20 | + # make sure names and comments are used according to the conventions |
| 21 | + - revive |
29 | 22 | # run static analysis and find errors |
30 | 23 | - staticcheck |
31 | | - |
32 | 24 | # find unused variables, functions, structs, types, etc. |
33 | 25 | - unused |
34 | | - |
35 | | - # parse and typecheck code |
36 | | - - typecheck |
37 | | - |
38 | | - # ensure that http response bodies are closed |
39 | | - - bodyclose |
40 | | - |
41 | | - - importas |
42 | | - |
43 | | -issues: |
44 | | - # don't use the default exclude rules, this hides (among others) ignored |
45 | | - # errors from Close() calls |
46 | | - exclude-use-default: false |
47 | | - |
48 | | - # list of things to not warn about |
49 | | - exclude: |
50 | | - # revive: do not warn about missing comments for exported stuff |
51 | | - - exported (function|method|var|type|const) .* should have comment or be unexported |
52 | | - # revive: ignore constants in all caps |
53 | | - - don't use ALL_CAPS in Go names; use CamelCase |
54 | | - # revive: lots of packages don't have such a comment |
55 | | - - "package-comments: should have a package comment" |
56 | | - - "redefines-builtin-id:" |
| 26 | + exclusions: |
| 27 | + rules: |
| 28 | + - path: (.+)\.go$ |
| 29 | + text: exported (function|method|var|type|const) .* should have comment or be unexported |
| 30 | + - path: (.+)\.go$ |
| 31 | + text: don't use ALL_CAPS in Go names; use CamelCase |
| 32 | + - path: (.+)\.go$ |
| 33 | + text: "package-comments: should have a package comment" |
| 34 | + - path: (.+)\.go$ |
| 35 | + text: "redefines-builtin-id:" |
| 36 | + paths: |
| 37 | + - third_party$ |
| 38 | + - builtin$ |
| 39 | + - examples$ |
| 40 | +formatters: |
| 41 | + enable: |
| 42 | + - gofmt |
| 43 | + exclusions: |
| 44 | + paths: |
| 45 | + - third_party$ |
| 46 | + - builtin$ |
| 47 | + - examples$ |
0 commit comments