forked from k8sgateway/k8sgateway
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.golangci.yaml
111 lines (99 loc) · 3.72 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
# Configuration for make analyze
#
# For reference, consider:
#
# * https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
# * https://golangci-lint.run/usage/configuration/
#
linters:
# Disable all linters.
disable-all: true
# Enable specific linters
# https://golangci-lint.run/usage/linters/#enabled-by-default
enable:
# Given that we have not had linting enabled in this repository, it would be a large change to turn on all linters immediately.
# We are aiming to progressively enable linters.
# If you see a linter that can be added, please do so.
# See: https://github.com/solo-io/gloo-mesh-enterprise/blob/main/.golangci.yaml for a reference
- bodyclose
- ginkgolinter
- goimports
- nakedret
- predeclared
- usestdlibvars
- importas
# Settings dedicated to specific linters.
linters-settings:
importas:
alias:
- pkg: k8s.io/api/apps/v1
alias: appsv1
- pkg: k8s.io/api/core/v1
alias: corev1
- pkg: k8s.io/apimachinery/pkg/apis/meta/v1
alias: metav1
- pkg: k8s.io/api/batch/v1
alias: batchv1
- pkg: github.com/solo-io/gloo/test/kubernetes/testutils/clients
alias: kubetestclients
nakedret:
# The team consensus is that naked returns hinder the readability of the code.
# However, named return values can still be useful as documentation for certain scenarios.
# By setting this to 0 in lieu of the default 30, we will effectively allow named return
# values as long as they are included in the return statement(s) e.g.
# func foo() (a, b int) {
# a = 1
# b = 2
# c := 3
# d := 4
# // These are allowed
# return a, b
# return c, d
# return d, c
# // This is NOT allowed
# return
# // This is allowed but really, really bad. DO NOT do this.
# return b, a
max-func-lines: 0
issues:
# Maximum count of issues with the same text.
# Set to 0 to disable.
max-same-issues: 0
run:
# Number of CPUs to use when running golangci-lint.
# Default: the number of logical CPUs in the machine
# The GME team found performance to be better when using a subset of total CPUs, so we chose 4, like they did.
concurrency: 4
# Include test files or not.
# We have found that tests which break the linter are often symptomatic of a poorly written test.
# To avoid unintentionally introducing tests that don't do what we expect, we run the linter against them.
tests: true
# Timeout for analysis, e.g. 30s, 5m.
# We select 10 minutes somewhat arbitrarily.
# The idea is that we want a timeout that is long enough to allow the job to run.
# If we find that the job is timing out, we can explore ways to make this job run faster, or increase the timeout.
timeout: 10m
skip-dirs:
# don't lint ruleguard files
- test/rules
# don't lint gomock intermediate files
- 'gomock_reflect_\d*'
# output configuration options
output:
# Format: colored-line-number|line-number|json|colored-tab|tab|checkstyle|code-climate|junit-xml|github-actions|teamcity
#
# Multiple can be specified by separating them by comma, output can be provided
# for each of them by separating format name and path by colon symbol.
# Output path can be either `stdout`, `stderr` or path to the file to write to.
# Example: "checkstyle:report.xml,json:stdout,colored-line-number"
#
# Default: colored-line-number
format: colored-line-number
# Print lines of code with issue.
print-issued-lines: true
# Print linter name in the end of issue text.
print-linter-name: true
# Make issues output unique by line.
uniq-by-line: true
# Sort results by: filepath, line and column.
sort-results: true