forked from elastic/cloudbeat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.golangci.yaml
146 lines (142 loc) · 4.13 KB
/
.golangci.yaml
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
run:
timeout: 15m
linters:
enable:
- canonicalheader
- containedctx
- contextcheck
- exhaustruct
- exportloopref
- fatcontext
- gci
- gocritic
- gocyclo
- gofmt
- gomodguard
- misspell
- nolintlint
- prealloc
- reassign
- revive
- testifylint
- unconvert
- unparam
- unused
- whitespace
issues:
exclude-rules:
- path: _test\.go
linters: [prealloc]
- path: resources/utils/testhelper/*.go
linters: [prealloc]
linters-settings:
gocritic:
settings:
ifElseChain:
minThreshold: 3
gomodguard:
blocked:
modules:
- github.com/pkg/errors:
recommendations:
- errors
reason: "Package is deprecated"
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/elastic/cloudbeat) # Custom section: groups all imports with the specified Prefix.
skip-generated: true
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
custom-order: false
govet:
enable-all: true
disable:
- fieldalignment
settings:
printf:
funcs:
- Infof
- Debugf
- Warnf
- Errorf
- Fatalf
- Panicf
- DPanicf
exhaustruct:
# List of regular expressions to match struct packages and names.
# If this list is empty, all structs are tested.
# Default: []
include:
- '.*cloudbeat.*fetching.ResourceInfo'
- '.*cloudbeat.*fetching.fetchers.*'
# Check that individual benchmarks always have their dependencies initialized
- '.*cloudbeat.*flavors.benchmark.*'
- '.*cloudbeat.*governance.Subscription'
- '.*cloudbeat.*governance.ManagementGroup'
exclude:
- '.*cloudbeat.*fetching.fetchers.k8s.FileCommonData'
- '.*cloudbeat.*fetching.fetchers.k8s.ProcCommonData'
- '.*cloudbeat.*fetching.fetchers.*<anonymous>'
- '.*cloudbeat.*flavors.benchmark.*<anonymous>'
revive:
enable-all-rules: true
rules:
# Configuration for enabled rules
- name: cognitive-complexity
arguments: [30]
- name: cyclomatic
arguments: [15]
- name: unhandled-error
arguments:
- "bytes.Buffer.WriteString" # Always returns nil error
# TODO: work on these
- name: blank-imports
disabled: true
- name: confusing-naming
disabled: true
- name: exported
disabled: true
- name: function-length
disabled: true
- name: get-return
disabled: true
- name: import-alias-naming
disabled: true
- name: import-shadowing
disabled: true
- name: unchecked-type-assertion
disabled: true
- name: var-naming
disabled: true
# No plan to enable these
- name: add-constant
disabled: true # Very restrictive rule that requires exporting everything to a constant
- name: bare-return
disabled: true # Are bare returns really that bad?
- name: line-length-limit
disabled: true # Annoying to enforce
- name: max-public-structs
disabled: true
- name: unused-receiver
disabled: true # Too many results
unused:
# Mark all struct fields that have been written to as used.
field-writes-are-uses: false
# Mark all exported fields as used.
exported-fields-are-used: false
# Mark all local variables as used.
local-variables-are-used: false
tenv:
all: true
prealloc:
simple: true
range-loops: true
for-loops: false