Skip to content

Commit 03664be

Browse files
committed
Document disabled lints, especially unhandled-error
With this, `revive.toml` mentions all currently-available lints. Some seem desirable, but they have more lint failures than I feel like tackling at the moment :) So they're just documented for now. --- `unhandled-error` I'd *love* to enable immediately, but ~300 warnings is far too many. Newly-introduced violations of other lints would just be lost in the noise. Reducing (or rarely whitelisting) these seems necessary before enabling, which IMO should be considered fairly high priority. Missing error handling is pretty frequently a source of hard-to-identify misbehavior, and a lint like this is the only feasible way to catch many cases. It's just far too hard to reliably catch during code review (as evidence: 300 cases!), especially when the returned value(s) are not assigned to anything.
1 parent db2a0e5 commit 03664be

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

revive.toml

+41
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ warningCode = 0
2929

3030
#### higher value stuff
3131

32+
# this is basically errcheck, warns on errs that are not checked.
33+
# strongly desired, but disabled due to 300 failures (to be tackled incrementally).
34+
# [rule.unhandled-error]
35+
3236
# general defer gotchas.
3337
#
3438
# in particular: "recover" warns about unsafe use of recover().
@@ -55,3 +59,40 @@ arguments=[["loop","method-call","recover","return"]]
5559
[rule.unconditional-recursion] # probably a good idea
5660
[rule.unreachable-code] # code simplifier
5761
[rule.waitgroup-by-value] # correct use of sync code, important
62+
63+
#### unused utilities
64+
65+
# [rule.file-header] # could possibly replace `copyright -verifyOnly`?
66+
# [rule.imports-blacklist] # simple way to ban imports / enforce wrappers, likely useful
67+
68+
#### disabled but maybe desirable
69+
70+
# [rule.bare-return] # probably beneficial as it's slightly error-prone, but 2,000 failures
71+
# [rule.bool-literal-in-expr] # minor code simplifier, few failures
72+
# [rule.confusing-results] # maybe beneficial, only a few failures
73+
# [rule.deep-exit] # probably a good idea in most code, some failures, but not trivial to adopt
74+
# [rule.duplicated-imports] # minor, but may be worthwhile. failures are weird but harmless
75+
# [rule.early-return] # minor code simplifier, a handful of failures
76+
# [rule.get-return] # existing failures are intentional + desirable, but in principle it's a fine idea
77+
# [rule.import-shadowing] # probably beneficial, but 750 failures
78+
# [rule.redefines-builtin-id] # probably beneficial, few failures
79+
# [rule.struct-tag] # probably beneficial, a few failures
80+
# [rule.superfluous-else] # minor code simplifier, a few failures
81+
# [rule.unexported-naming] # probably beneficial, but 300 failures
82+
# [rule.unused-parameter] # minor code simplifier / clarifier, but 250 failures
83+
# [rule.unused-receiver] # minor code simplifier / clarifier, but 500 failures
84+
85+
#### probably undesirable
86+
87+
# [rule.add-constant] # extremely noisy. 18,000 failures, overwhelmingly for tests or 0/1 which seem totally fine
88+
# [rule.argument-limit] # too arbitrary
89+
# [rule.cognitive-complexity] # dubious value, but possibly interesting
90+
# [rule.confusing-naming] # dubious value, ~50 failures
91+
# [rule.cyclomatic] # dubious value, but possibly interesting
92+
# [rule.empty-block] # easily noticed in code review, but also warns on documented no-op branches, which seem fine
93+
# [rule.empty-lines] # low value, many failures
94+
# [rule.flag-parameter] # interesting, but very noisy
95+
# [rule.function-result-limit] # too arbitrary, easily noticed in code review
96+
# [rule.line-length-limit] # too arbitrary
97+
# [rule.max-public-structs] # too arbitrary
98+
# [rule.unnecessary-stmt] # dubious value

0 commit comments

Comments
 (0)