-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy path.golangci.yml
More file actions
118 lines (108 loc) · 4.07 KB
/
.golangci.yml
File metadata and controls
118 lines (108 loc) · 4.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/golangci.jsonschema.json
#
# Paper Compute Co. — opinionated golangci-lint defaults
# https://golangci-lint.run/docs/configuration/file/
version: "2"
linters:
enable:
# --- Bugs ---
- bodyclose # Report unclosed HTTP response bodies.
- contextcheck # Non-inherited context usage.
- durationcheck # Accidental time.duration * time.duration.
- errcheck # Raises unchecked errors.
- errchkjson # Unchecked JSON marshal/unmarshal errors.
- errorlint # Go 1.13+ error wrapping best practices.
- exhaustive # Check exhaustiveness of enum switch statements.
- fatcontext # Nested contexts in loops / closures.
- govet # Examines and reports suspicious constructs.
- ineffassign # Reports when assignments to existing vars are not used.
- makezero # Slices with non-zero len that are later appended to.
- musttag # Missing struct tags for (un)marshaling.
- nilerr # Returning nil when err != nil.
- nilnesserr # Reports returning a different nil error after err check.
- noctx # Reports HTTP requests without context.
- unused # Checks Go code for unused consts, vars, funcs, types.
# --- Code quality ---
- copyloopvar # loop variable copy issues
- dupword # duplicate words in comments / strings
- goconst # repeated strings that could be constants
- gocritic # broad set of style & performance diagnostics
- gosec # security-oriented checks
- misspell # common English typos
- nakedret # naked returns in long functions
- prealloc # slice pre-allocation hints
- predeclared # shadowing predeclared identifiers
- reassign # package-variable reassignment
- revive # golint successor — style & correctness
- unconvert # unnecessary type conversions
- unparam # unused function parameters
- wastedassign # wasted assignments
- whitespace # unnecessary blank lines
# --- Modernization ---
- exptostd # x/exp -> stdlib replacements
- intrange # use integer ranges in for loops
- modernize # modern Go idioms
- usestdlibvars # use stdlib constants/variables
- usetesting # prefer testing package helpers
- perfsprint # faster fmt.Sprintf alternatives
# --- Style ---
- errname # error/sentinel naming conventions
- nolintlint # well-formed nolint directives
- recvcheck # consistent receiver types
- nosprintfhostport # host:port via net.JoinHostPort
disable:
# forbid all init() - we do this when the tuis come up to force color alignments.
# TODO @jpmcb - we should refactor this to avoid using an "init()"
- gochecknoinits
exclusions:
presets:
- comments
- std-error-handling
- common-false-positives
- legacy
generated: lax
rules:
- path: _test\.go
linters:
- errcheck
- gosec
- dupl
- goconst
- gocritic
- revive
- unparam
# @jpmcb - TODO: rename these packages to avoid "meaningless" names
- path: api/
text: "var-naming: avoid meaningless package names"
linters:
- revive
- path: pkg/utils/
text: "var-naming: avoid meaningless package names"
linters:
- revive
formatters:
enable:
- gci
- gofmt
- goimports
- gofumpt
settings:
gci:
sections:
- standard
- default
- prefix(github.com/papercomputeco/tapes)
goimports:
local-prefixes:
- github.com/papercomputeco/tapes
exclusions:
generated: lax
paths:
- .dagger/internal
- .dagger/dagger.gen.go
issues:
# Show all issues
max-issues-per-linter: 0
max-same-issues: 0
run:
timeout: 5m