@@ -63,68 +63,103 @@ linters:
63
63
enable-all-rules : true
64
64
rules :
65
65
# 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.
68
73
disabled : true
69
- - name : add-constant
74
+ - name : unchecked-type-assertion
75
+ # 14 occurrences. This is generally risky and encourages bad coding for newcomers.
70
76
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.
72
79
disabled : true
73
- - name : package-comments
80
+ - name : import-shadowing
81
+ # 44 occurrences. Shadowing makes things prone to errors / confusing to read.
74
82
disabled : true
75
- - name : cyclomatic
83
+ - name : use-errors-new
84
+ # 84 occurrences. Improves error testing.
76
85
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.
78
93
disabled : true
79
- - name : function-length
94
+ - name : defer
95
+ # 7 occurrences. Confusing to read for newbies.
80
96
disabled : true
81
- - name : flag-parameter
97
+ - name : confusing-naming
98
+ # 10 occurrences. Hurts readability.
82
99
disabled : true
83
- - name : max-public-structs
100
+ - name : early-return
101
+ # 10 occurrences. Would improve readability.
84
102
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.
86
114
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]
87
123
- 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.
88
126
disabled : true
89
- - name : nested-structs
127
+ - name : comment-spacings
128
+ # 50 occurrences. Makes code look less wonky / ease readability.
90
129
disabled : true
91
130
- name : use-any
131
+ # 30 occurrences. `any` instead of `interface{}`. Cosmetic.
92
132
disabled : true
93
- # FIXME: we should enable these below
94
133
- name : empty-lines
134
+ # 85 occurrences. Makes code look less wonky / ease readability.
95
135
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...
111
138
disabled : true
112
- - name : early-return
139
+ - name : exported
140
+ # 577 occurrences. Forces documentation of any exported symbol.
113
141
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.
115
146
disabled : true
116
- - name : function-result-limit
147
+ - name : nested-structs
148
+ # 5 occurrences. Trivial. This is not that hard to read.
117
149
disabled : true
118
- - name : unnecessary-stmt
150
+ - name : flag-parameter
151
+ # 52 occurrences. Not sure if this is valuable.
119
152
disabled : true
120
- - name : unchecked-type-assertion
153
+ - name : unused-parameter
154
+ # 505 occurrences. A lot of work for a marginal improvement.
121
155
disabled : true
122
- - name : bare-return
156
+ - name : unused-receiver
157
+ # 31 occurrences. Ibid.
123
158
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
127
161
disabled : true
162
+
128
163
depguard :
129
164
rules :
130
165
no-patent :
0 commit comments