|
1 | 1 | # note: GolangCI-Lint also searches for config files in all directories from the directory of the first analyzed path up to the root. |
2 | 2 | run: |
| 3 | + build-tags: |
| 4 | + - utils |
| 5 | + |
3 | 6 | # Timeout for analysis, e.g. 30s, 5m. |
4 | 7 | # gobot is very expensive, on a machine with heavy load it takes some minutes |
5 | 8 | # for first run or after empty the cache by 'golangci-lint cache clean' |
|
31 | 34 | linters: |
32 | 35 | # currently active linters: |
33 | 36 | # |
34 | | - #INFO [lintersdb] Active 42 linters: [asasalint asciicheck bidichk contextcheck decorder depguard dupword durationcheck errcheck exportloopref |
35 | | - # gocheckcompilerdirectives gofmt gofumpt goimports gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper ineffassign makezero mirror |
36 | | - # misspell musttag nilerr nilnil nolintlint nosprintfhostport prealloc reassign revive staticcheck tagalign tenv testableexamples tparallel unconvert unparam |
37 | | - # unused wastedassign] |
| 37 | + # INFO [lintersdb] Active 64 linters: [asasalint asciicheck bidichk bodyclose containedctx contextcheck decorder depguard dogsled dupword durationcheck |
| 38 | + # errcheck errchkjson errorlint exportloopref forcetypeassert gci gocheckcompilerdirectives gochecknoinits gochecksumtype gocritic gofmt gofumpt goimports |
| 39 | + # gomoddirectives gomodguard goprintffuncname gosec gosimple govet grouper inamedparam ineffassign lll makezero mirror misspell musttag nakedret nilerr nilnil |
| 40 | + # noctx nolintlint nonamedreturns nosprintfhostport perfsprint prealloc predeclared protogetter reassign revive sloglint staticcheck tagalign tenv |
| 41 | + # testableexamples testifylint thelper tparallel unconvert unparam unused usestdlibvars wastedassign] |
38 | 42 |
|
39 | 43 | enable-all: true |
40 | 44 |
|
@@ -72,39 +76,23 @@ linters: |
72 | 76 | - testpackage # not needed, we use the same name for test package to have access to unexposed items |
73 | 77 | - wrapcheck # not needed (we allow errors from interface methods) |
74 | 78 | - zerologlint # not needed (related to zerolog package) |
75 | | - # important to have |
76 | | - - errorlint # useful (reduce bugs), but suppress the "Use `%w` to format errors" check |
77 | | - - forcetypeassert # useful (reduce bugs) |
78 | | - - nakedret # very useful together with "nonamedreturns" (reduce bugs) |
79 | | - - nonamedreturns # very useful (reduce bugs) |
80 | 79 | # useful for the future |
81 | | - - bodyclose # maybe useful (reduce bugs), exclusions for tests needed |
82 | | - - containedctx # useful (structs are not for context wrapping) |
83 | 80 | - cyclop # useful with some tweeks (better understandable code), see also gocyclo |
84 | | - - dogsled # useful with some tweeks (e.g. exclude tests) |
85 | 81 | - dupl # useful with some tweeks (reduce bugs and lines of code) |
86 | | - - errchkjson # useful (reduce bugs) |
87 | 82 | - errname # useful for common style |
88 | 83 | - exhaustruct # useful with some exclusions for existing code (e.g. mavlink/common/common.go) |
89 | 84 | - funlen # useful with some tweeks (reduce bugs, simplify code, better understandable code) |
90 | | - - gci # useful (improve readability) |
91 | 85 | - gocognit # useful with some tweeks (better understandable code) |
92 | 86 | - goconst # useful (reduce bugs) |
93 | | - - gocritic # useful with some exclusions for existing code (e.g. mavlink/common/common.go) |
94 | 87 | - gocyclo # useful with some tweeks (better understandable code) |
95 | 88 | - goheader # useful, if we introduce a common header (e.g. for copyright) |
96 | 89 | - gomnd # useful with some exclusions for existing code (e.g. mavlink.go) |
97 | 90 | - interfacebloat # useful with some exclusions at usage of external packages |
98 | | - - lll # useful with some exclusions for existing code (e.g. mavlink/common/common.go) |
99 | 91 | - maintidx # useful with some tweeks (better understandable code), maybe use instead "gocyclo", "gocognit" , "cyclop" |
100 | 92 | - nestif # useful (reduce bugs, simplify code, better understandable code) |
101 | 93 | - nlreturn # more common style, but could become annoying |
102 | | - - noctx # maybe good (show used context explicit) |
103 | | - - predeclared # useful (reduce bugs) |
104 | 94 | - stylecheck # useful with some tweaking (e.g. underscores in names should be allowed - we use it for constants retrieved from C/C++) |
105 | 95 | - tagliatelle # maybe useful with some tweaking or excluding |
106 | | - - thelper # useful |
107 | | - - usestdlibvars # useful |
108 | 96 | - varnamelen # maybe useful with some tweaking, but many findings |
109 | 97 | - whitespace # more common style, but could become annoying |
110 | 98 | - wsl # more common style, but could become annoying |
@@ -142,6 +130,36 @@ linters-settings: |
142 | 130 | - "and" |
143 | 131 | - "a" |
144 | 132 |
|
| 133 | + errorlint: |
| 134 | + # Default: true |
| 135 | + # %v should be used by default over %w, see https://github.com/uber-go/guide/blob/master/style.md#error-wrapping |
| 136 | + errorf: false |
| 137 | + # Permit more than 1 %w verb, valid per Go 1.20 (Requires errorf:true) |
| 138 | + # Default: true |
| 139 | + errorf-multi: false |
| 140 | + |
| 141 | + gci: |
| 142 | + # Section configuration to compare against. |
| 143 | + # Section names are case-insensitive and may contain parameters in (). |
| 144 | + # The default order of sections is `standard > default > custom > blank > dot`, |
| 145 | + # If `custom-order` is `true`, it follows the order of `sections` option. |
| 146 | + # Default: ["standard", "default"] |
| 147 | + sections: |
| 148 | + - standard # Standard section: captures all standard packages. |
| 149 | + - default # Default section: contains all imports that could not be matched to another section type. |
| 150 | + - prefix(gobot.io/x/gobot/) # Custom section: groups all imports with the specified Prefix. |
| 151 | + #- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. |
| 152 | + #- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. |
| 153 | + # Enable custom order of sections. |
| 154 | + # If `true`, make the section order the same as the order of `sections`. |
| 155 | + # Default: false |
| 156 | + custom-order: true |
| 157 | + |
| 158 | + gocritic: |
| 159 | + disabled-checks: |
| 160 | + - assignOp # very opinionated |
| 161 | + - appendAssign # mostly used by intention |
| 162 | + |
145 | 163 | nolintlint: |
146 | 164 | # Enable to require an explanation of nonzero length after each nolint directive. |
147 | 165 | # Default: false |
|
0 commit comments