1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
# Copyright (C) 2022-2023 Luke Shumaker <lukeshu@lukeshu.com>
#
# SPDX-License-Identifier: GPL-2.0-or-later
linters:
enable-all: true
disable:
# Deprecated
- deadcode # deprecated, replaced by 'unused'
- exhaustivestruct # deprecated, replaced by 'exhaustruct'
- golint # deprecated, replaced by 'revive'
- ifshort # deprecated
- interfacer # deprecated
- maligned # deprecated, replaced by 'govet fieldalignement'
- nosnakecase # deprecated, replaced by 'revive var-naming'
- scopelint # deprecated, replaced by 'exportloopref'
- structcheck # deprecated, replaced by 'unused'
- varcheck # deprecated, replaced by 'unused'
# Don't support Go 1.18 generics yet
- rowserrcheck
- wastedassign
- ireturn # golangci-lint doesn't claim it doesn't, but it doesn't
# Style
- godot
- lll
- nlreturn
- nonamedreturns # I name returns for godoc purposes.
- wsl
# Complexity; sometimes code is just complex.
- cyclop
- funlen
- gocognit
- gocyclo
- maintidx
- nestif
# Miscellaneous
- goerr113 # forbids fmt.Errorf(%w), which is just silly
- godox # I'm OK checking in to-be-completed tasks
# These are disabled not because I think they're bad, but because
# they currently don't pass, and I haven't really evaluated them yet.
- exhaustive
- exhaustruct
- gochecknoglobals
- gochecknoinits
- testpackage
- thelper
- varnamelen
- wrapcheck
linters-settings:
errcheck:
exclude-functions:
- "git.lukeshu.com/btrfs-progs-ng/lib/textui.Fprintf"
gci:
sections:
- standard
- default
- prefix(git.lukeshu.com/btrfs-progs-ng)
gocritic:
disabled-checks:
- appendAssign
gofmt:
simplify: true
gomnd:
ignored-numbers:
- '2'
ignored-functions:
- 'binutil.NeedNBytes'
- 'textui.Tunable'
gomoddirectives:
replace-allow-list:
- github.com/jacobsa/fuse
gosec:
excludes:
- G104 # duplicates errcheck
- G304 # this program opens arbitrary files
- G306 # users should set umask if they want that
nolintlint:
require-explanation: true
require-specific: true
allow-no-explanation:
- dupword
revive:
enable-all-rules: true
rules:
- { name: call-to-gc, disabled: true }
- { name: exported, disabled: true } # TODO: Add doc comments to exported identifiers
- { name: file-header, disabled: true } # TODO: This might actually be useful for copyright
- { name: flag-parameter, disabled: true }
- { name: modifies-value-receiver, disabled: true }
- { name: unexported-return, disabled: true }
# Style.
- { name: banned-characters, disabled: true }
- { name: line-length-limit, disabled: true }
- { name: nested-structs, disabled: true }
- { name: var-naming, disabled: true }
# Complexity; sometimes code is just complex.
- { name: argument-limit, disabled: true }
- { name: cognitive-complexity, disabled: true }
- { name: cyclomatic, disabled: true }
- { name: function-length, disabled: true }
- { name: function-result-limit, disabled: true }
- { name: max-public-structs, disabled: true }
# Duplicates.
- { name: add-constant, disabled: true } # duplicates gomnd
- { name: receiver-naming, disabled: true } # duplicates stylecheck ST1016
- { name: unhandled-error, disabled: true } # duplicates errcheck
# Buggy.
- { name: confusing-naming, disabled: true } # false positive on methods implementing interfaces
- { name: import-shadowing, disabled: true } # false positive on methods
stylecheck:
checks:
- "all"
- "-ST1003" # CONST_VAL names for consistency with other btrfs code
tagliatelle:
case:
use-field-name: true
rules:
json: pascal
issues:
exclude-use-default: false
exclude-rules:
# Unchecked type asserts in tests are fine.
- linters: [forcetypeassert]
path: ".*_test\\.go"
# Ignore false positives that don't actually have any words.
- linters: [dupword]
source: "^[^a-zA-Z]*$"
# https://github.com/dominikh/go-tools/issues/1347
- linters: [stylecheck]
text: '^ST1016: methods on the same type should have the same receiver name \(seen 1x "(a|dst)", \d+x "[^"]+"\)$'
max-issues-per-linter: 0
max-same-issues: 0
|