Skip to content

Commit cad0ecf

Browse files
committed
feat: add 80-reckless and 90-daredevil
The aim is to show what golangci-lint could report if everything is enabled.
1 parent 92f55c3 commit cad0ecf

File tree

6 files changed

+514
-2
lines changed

6 files changed

+514
-2
lines changed

80-reckless/.golangci.yml

Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
1+
---
2+
# golangci-lint configuration file made by @ccoVeille
3+
# Source: https://github.com/ccoVeille/golangci-lint-config-examples/
4+
# Author: @ccoVeille
5+
# License: MIT
6+
# Variant: 80-reckless
7+
# Version: v1.1.0
8+
#
9+
run:
10+
# Timeout for analysis, e.g. 30s, 5m.
11+
# Default: 1m
12+
timeout: 5m
13+
14+
issues:
15+
exclude-use-default: false
16+
17+
# The list of ids of default excludes to include or disable.
18+
# https://golangci-lint.run/usage/false-positives/#default-exclusions
19+
# Default: []
20+
include:
21+
- EXC0014
22+
23+
# Maximum issues count per one linter.
24+
# Set to 0 to disable.
25+
# Default: 50
26+
max-issues-per-linter: 0
27+
# Maximum count of issues with the same text.
28+
# Set to 0 to disable.
29+
# Default: 3
30+
max-same-issues: 0
31+
32+
linters:
33+
# some linters are enabled by default
34+
# https://golangci-lint.run/usage/linters/
35+
#
36+
# enable some extra linters
37+
enable-all: true
38+
39+
linters-settings:
40+
gci: # define the section orders for imports
41+
sections:
42+
# Standard section: captures all standard packages.
43+
- standard
44+
# Default section: catchall that is not standard or custom
45+
- default
46+
# linters that related to local tool, so they should be separated
47+
- localmodule
48+
49+
usestdlibvars:
50+
# Suggest the use of http.MethodXX.
51+
# Default: true
52+
http-method: true
53+
# Suggest the use of http.StatusXX.
54+
# Default: true
55+
http-status-code: true
56+
# Suggest the use of time.Weekday.String().
57+
# Default: true
58+
time-weekday: true
59+
# Suggest the use of constants available in time package
60+
# Default: false
61+
time-layout: true
62+
63+
staticcheck:
64+
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
65+
checks: ["all"]
66+
67+
nolintlint:
68+
# Enable to require an explanation of nonzero length
69+
# after each nolint directive.
70+
# Default: false
71+
require-explanation: true
72+
# Enable to require nolint directives to mention the specific
73+
# linter being suppressed.
74+
# Default: false
75+
require-specific: true
76+
77+
govet:
78+
enable-all: true
79+
80+
gocritic:
81+
enable-all: true
82+
disabled-checks:
83+
# Detects comments with non-idiomatic formatting.
84+
# https://go-critic.com/overview.html#commentformatting
85+
# Reason: Duplicate with other linters
86+
- commentFormatting
87+
88+
# Runs user-defined rules using ruleguard linter.
89+
# https://go-critic.com/overview.html#ruleguard
90+
# Reason: we don't need it
91+
- ruleguard
92+
93+
# Detects when default case in switch isn't on 1st or last position.
94+
# https://go-critic.com/overview.html#defaultcaseorder
95+
# Reason: we don't care
96+
- defaultCaseOrder
97+
98+
# Detects empty string checks that can be written more idiomatically.
99+
# https://go-critic.com/overview.html#emptystringtest
100+
# Reason: we don't want to enforce it, using len(s) == 0 is ok
101+
- emptyStringTest
102+
103+
# Detects unwanted dependencies on the evaluation order.
104+
# https://go-critic.com/overview.html#evalorder
105+
# Reason: require code rewrite for almost nothing
106+
- evalOrder
107+
108+
# Detects when imported package names shadowed in the assignments.
109+
# https://go-critic.com/overview.html#importshadow
110+
# Reason: require code rewrite for almost nothing
111+
- importShadow
112+
113+
# Detects if function parameters could be combined by type and suggest the way to do it.
114+
# https://go-critic.com/overview.html#paramtypecombine
115+
# Reason: too opinionated
116+
- paramTypeCombine
117+
118+
# Detects expressions like []rune(s)[0] that may cause unwanted rune slice allocation.
119+
# https://go-critic.com/overview.html#preferdecoderune
120+
# Reason: too opinionated
121+
- preferDecodeRune
122+
123+
# Detects WriteRune calls with rune literal argument that is single byte and reports to use WriteByte instead.
124+
# https://go-critic.com/overview.html#preferwritebyte
125+
# Reason: too opinionated
126+
- preferWriteByte
127+
128+
# Detects loops that copy big objects during each iteration.
129+
# https://go-critic.com/overview.html#rangevalcopy
130+
# Reason: we don't care that much about RAM
131+
- rangeValCopy
132+
133+
# Detects TODO comments without detail/assignee.
134+
# https://go-critic.com/overview.html#todocommentwithoutdetail
135+
# Reason: no need
136+
- todoCommentWithoutDetail
137+
138+
# Ensures that `//nolint` comments include an explanation.
139+
# https://go-critic.com/overview.html#whynolint
140+
# Reason: nolintlint already enforces it
141+
- whyNoLint
142+
143+
revive:
144+
enable-all-rules: true
145+
rules:
146+
# we must provide configuration for linter that requires them
147+
# enable-all-rules is OK, but many revive linters expect configuration
148+
# and cannot work without them
149+
150+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#add-constant
151+
- name: add-constant
152+
arguments:
153+
- maxLitCount: "3"
154+
allowStrs: '""'
155+
allowInts: "0,1,2"
156+
allowFloats: "0.0,0.,1.0,1.,2.0,2."
157+
158+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cognitive-complexity
159+
- name: cognitive-complexity
160+
severity: warning
161+
arguments: [7]
162+
163+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument
164+
- name: context-as-argument
165+
arguments:
166+
- allowTypesBefore: "*testing.T"
167+
168+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#cyclomatic
169+
- name: cyclomatic
170+
arguments: [3]
171+
172+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#exported
173+
- name: exported
174+
arguments:
175+
# enables checking public methods of private types
176+
- "checkPrivateReceivers"
177+
# make error messages clearer
178+
- "sayRepetitiveInsteadOfStutters"
179+
180+
# this linter completes errcheck linter, it will report method called without handling the error
181+
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#unhandled-error
182+
- name: unhandled-error
183+
arguments: # here are the exceptions we don't want to be reported
184+
- "fmt.Print.*"
185+
- "fmt.Fprint.*"
186+
- "bytes.Buffer.Write"
187+
- "bytes.Buffer.WriteByte"
188+
- "bytes.Buffer.WriteString"
189+
- "strings.Builder.WriteString"
190+
- "strings.Builder.WriteRune"
191+
192+
# disable everything we don't want
193+
- name: line-length-limit
194+
disabled: true
195+
- name: argument-limit
196+
disabled: true
197+
- name: banned-characters
198+
disabled: true
199+
- name: max-public-structs
200+
disabled: true
201+
- name: function-result-limit
202+
disabled: true
203+
- name: function-length
204+
disabled: true
205+
- name: file-header
206+
disabled: true
207+
- name: empty-lines
208+
disabled: true
209+
210+
dupword:
211+
# Keywords used to ignore detection.
212+
# Default: []
213+
ignore:
214+
# - "blah" # this will accept "blah blah …" as a valid duplicate word
215+
216+
misspell:
217+
# Correct spellings using locale preferences for US or UK.
218+
# Setting locale to US will correct the British spelling of 'colour' to 'color'.
219+
# Default ("") is to use a neutral variety of English.
220+
locale: US
221+
222+
# List of words to ignore
223+
# among the one defined in https://github.com/golangci/misspell/blob/master/words.go
224+
ignore-words:
225+
# - valor
226+
# - and
227+
228+
# Extra word corrections.
229+
extra-words:
230+
# - typo: "whattever"
231+
# correction: "whatever"
232+
233+
output:
234+
# Make issues output unique by line.
235+
# Default: true
236+
uniq-by-line: false
237+
238+
# Sort results by the order defined in `sort-order`.
239+
# Default: false
240+
sort-results: true
241+
242+
# Order to use when sorting results.
243+
# Require `sort-results` to `true`.
244+
# Possible values: `file`, `linter`, and `severity`.
245+
#
246+
# If the severity values are inside the following list, they are ordered in this order:
247+
# 1. error
248+
# 2. warning
249+
# 3. high
250+
# 4. medium
251+
# 5. low
252+
# Either they are sorted alphabetically.
253+
#
254+
# Default: ["file"]
255+
sort-order:
256+
- linter
257+
- severity
258+
- file # filepath, line, and column.
259+
260+
# Show statistics per linter.
261+
# Default: false
262+
show-stats: true

80-reckless/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Reckless Settings
2+
3+
See [.golangci.yml](.golangci.yml)
4+
5+
It's all most everything possible, but we exclude the noise
6+
7+
These settings are not indented to be used except for discovering new linters that you could enable on your code.
8+
9+
## License
10+
11+
License: MIT
12+
13+
Source: [@ccoVeille](https://github.com/ccoVeille/golangci-lint-config-examples)

0 commit comments

Comments
 (0)