Skip to content

Commit fd995d2

Browse files
committed
Lint config
Signed-off-by: Chris Koch <[email protected]>
1 parent 56d3416 commit fd995d2

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

.golangci.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
linters:
2+
enable:
3+
- containedctx
4+
- gocritic
5+
- godot
6+
- nilerr
7+
- revive
8+
- thelper
9+
- unconvert
10+
11+
linters-settings:
12+
revive:
13+
# Maximum number of open files at the same time.
14+
# See https://github.com/mgechev/revive#command-line-flags
15+
# Defaults to unlimited.
16+
max-open-files: 2048
17+
# When set to false, ignores files with "GENERATED" header, similar to golint.
18+
# See https://github.com/mgechev/revive#available-rules for details.
19+
# Default: false
20+
ignore-generated-header: true
21+
# Sets the default severity.
22+
# See https://github.com/mgechev/revive#configuration
23+
# Default: warning
24+
severity: error
25+
# Default: false
26+
# Sets the default failure confidence.
27+
# This means that linting errors with less than 0.8 confidence will be ignored.
28+
# Default: 0.8
29+
confidence: 0.8
30+
rules:
31+
- name: blank-imports
32+
- name: context-as-argument
33+
arguments:
34+
- allowTypesBefore: "*testing.T,*github.com/user/repo/testing.Harness"
35+
- name: context-keys-type
36+
- name: error-return
37+
- name: error-strings
38+
- name: error-naming
39+
- name: exported
40+
arguments:
41+
- "checkPrivateReceivers"
42+
- "sayRepetitiveInsteadOfStutters"
43+
- name: if-return
44+
- name: increment-decrement
45+
- name: var-naming
46+
- name: var-declaration
47+
- name: package-comments
48+
- name: range
49+
- name: receiver-naming
50+
- name: time-naming
51+
- name: unexported-return
52+
- name: indent-error-flow
53+
- name: errorf
54+
55+
- name: early-return
56+
- name: file-header
57+
arguments:
58+
- "Copyright 20[1-2][0-9](-20[1-2][0-9])? the u-root Authors. All rights reserved Use of this source code is governed by a BSD-style license that can be found in the LICENSE file."

.revive.toml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
ignoreGeneratedHeader = false
2+
severity = "warning"
3+
confidence = 0.8
4+
errorCode = 0
5+
warningCode = 0
6+
7+
[rule.blank-imports]
8+
[rule.context-as-argument]
9+
[rule.context-keys-type]
10+
[rule.dot-imports]
11+
[rule.error-return]
12+
[rule.error-strings]
13+
[rule.error-naming]
14+
[rule.exported]
15+
[rule.if-return]
16+
[rule.increment-decrement]
17+
[rule.var-naming]
18+
[rule.var-declaration]
19+
[rule.package-comments]
20+
[rule.range]
21+
[rule.receiver-naming]
22+
[rule.time-naming]
23+
[rule.unexported-return]
24+
[rule.indent-error-flow]
25+
[rule.errorf]
26+
[rule.early-return]
27+
[rule.file-header]
28+
arguments=["Copyright 20[1-2][0-9](-20[1-2][0-9])? the u-root Authors. All rights reserved Use of this source code is governed by a BSD-style license that can be found in the LICENSE file."]

0 commit comments

Comments
 (0)