Skip to content

Commit 8893fe4

Browse files
committed
Lint: revive: review and organization off all rules
Signed-off-by: apostasie <[email protected]>
1 parent 77b0edc commit 8893fe4

File tree

1 file changed

+72
-37
lines changed

1 file changed

+72
-37
lines changed

.golangci.yml

Lines changed: 72 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -63,68 +63,103 @@ linters:
6363
enable-all-rules: true
6464
rules:
6565
# See https://revive.run/r
66-
# Below are unsorted, and we might want to review them to decide which one we want to enable
67-
- name: exported
66+
67+
##### P0: we should do it ASAP.
68+
- name: max-control-nesting
69+
# 10 occurences (at default 5). Deep nesting hurts readibility.
70+
arguments: [7]
71+
- name: deep-exit
72+
# 11 occurrences. Do not exit in random places.
6873
disabled: true
69-
- name: add-constant
74+
- name: unchecked-type-assertion
75+
# 14 occurrences. This is generally risky and encourages bad coding for newcomers.
7076
disabled: true
71-
- name: cognitive-complexity
77+
- name: bare-return
78+
# 31 occurrences. Bare returns are just evil, very unfriendly, and make reading and editing much harder.
7279
disabled: true
73-
- name: package-comments
80+
- name: import-shadowing
81+
# 44 occurrences. Shadowing makes things prone to errors / confusing to read.
7482
disabled: true
75-
- name: cyclomatic
83+
- name: use-errors-new
84+
# 84 occurrences. Improves error testing.
7685
disabled: true
77-
- name: deep-exit
86+
87+
##### P1: consider making a dent on these, but not critical.
88+
- name: argument-limit
89+
# 4 occurrences (at default 8). Long windy arguments list for functions are hard to read. Use structs instead.
90+
arguments: [12]
91+
- name: unnecessary-stmt
92+
# 5 occurrences. Increase readability.
7893
disabled: true
79-
- name: function-length
94+
- name: defer
95+
# 7 occurrences. Confusing to read for newbies.
8096
disabled: true
81-
- name: flag-parameter
97+
- name: confusing-naming
98+
# 10 occurrences. Hurts readability.
8299
disabled: true
83-
- name: max-public-structs
100+
- name: early-return
101+
# 10 occurrences. Would improve readability.
84102
disabled: true
85-
- name: max-control-nesting
103+
- name: function-result-limit
104+
# 12 occurrences (at default 3). A function returning many results is probably too big.
105+
arguments: [7]
106+
- name: function-length
107+
# 155 occurrences (at default 0, 75). Really long functions should really be broken up in most cases.
108+
arguments: [0, 400]
109+
- name: cyclomatic
110+
# 204 occurrences (at default 10)
111+
arguments: [100]
112+
- name: unhandled-error
113+
# 222 occurrences. Could indicate failure to handle broken conditions.
86114
disabled: true
115+
- name: cognitive-complexity
116+
arguments: [197]
117+
# 441 occurrences (at default 7). We should try to lower it (involves significant refactoring).
118+
119+
##### P2: nice to have.
120+
- name: max-public-structs
121+
# 7 occurrences (at default 5). Might indicate overcrowding of public API.
122+
arguments: [21]
87123
- name: confusing-results
124+
# 13 occurrences. Have named returns when the type stutters.
125+
# Makes it a bit easier to figure out function behavior just looking at signature.
88126
disabled: true
89-
- name: nested-structs
127+
- name: comment-spacings
128+
# 50 occurrences. Makes code look less wonky / ease readability.
90129
disabled: true
91130
- name: use-any
131+
# 30 occurrences. `any` instead of `interface{}`. Cosmetic.
92132
disabled: true
93-
# FIXME: we should enable these below
94133
- name: empty-lines
134+
# 85 occurrences. Makes code look less wonky / ease readability.
95135
disabled: true
96-
- name: unhandled-error
97-
disabled: true
98-
- name: confusing-naming
99-
disabled: true
100-
- name: unused-parameter
101-
disabled: true
102-
- name: unused-receiver
103-
disabled: true
104-
- name: import-shadowing
105-
disabled: true
106-
- name: use-errors-new
107-
disabled: true
108-
- name: argument-limit
109-
disabled: true
110-
- name: defer
136+
- name: package-comments
137+
# 100 occurrences. Better for documentation...
111138
disabled: true
112-
- name: early-return
139+
- name: exported
140+
# 577 occurrences. Forces documentation of any exported symbol.
113141
disabled: true
114-
- name: comment-spacings
142+
143+
###### Permanently disabled. Below have been reviewed and vetted to be unnecessary.
144+
- name: line-length-limit
145+
# Formatter `golines` takes care of this.
115146
disabled: true
116-
- name: function-result-limit
147+
- name: nested-structs
148+
# 5 occurrences. Trivial. This is not that hard to read.
117149
disabled: true
118-
- name: unnecessary-stmt
150+
- name: flag-parameter
151+
# 52 occurrences. Not sure if this is valuable.
119152
disabled: true
120-
- name: unchecked-type-assertion
153+
- name: unused-parameter
154+
# 505 occurrences. A lot of work for a marginal improvement.
121155
disabled: true
122-
- name: bare-return
156+
- name: unused-receiver
157+
# 31 occurrences. Ibid.
123158
disabled: true
124-
# Below have been reviewed and disabled
125-
- name: line-length-limit
126-
# Better dealt with by formatter golines
159+
- name: add-constant
160+
# 2605 occurrences. Kind of useful in itself, but unacceptable amount of effort to fix
127161
disabled: true
162+
128163
depguard:
129164
rules:
130165
no-patent:

0 commit comments

Comments
 (0)