Skip to content

Commit 8837f3d

Browse files
refactor: move all golangci-lint options from GHA to config file
1 parent 323a919 commit 8837f3d

File tree

2 files changed

+69
-11
lines changed

2 files changed

+69
-11
lines changed

.github/workflows/lint.yml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,6 @@ jobs:
2828
with:
2929
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
3030
version: latest
31-
32-
args: >
33-
--enable=errcheck,gocritic,gofmt,goimports,gosec,gosimple,govet,ineffassign,revive,staticcheck,typecheck,unused,bodyclose
34-
--fix=false
35-
--max-same-issues=20
36-
--out-${NO_FUTURE}format=colored-line-number
37-
--print-issued-lines=true
38-
--print-linter-name=true
39-
--sort-results=true
40-
--timeout=5m0s
41-
--uniq-by-line=false
4231
# Optional: working directory, useful for monorepos
4332
# working-directory: somedir
4433

.golangci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,75 @@
1+
linters:
2+
# Enable specific linter
3+
# https://golangci-lint.run/usage/linters/#enabled-by-default
4+
enable:
5+
- errcheck
6+
- gocritic
7+
- gofmt
8+
- goimports
9+
- gosec
10+
- gosimple
11+
- govet
12+
- ineffassign
13+
- revive
14+
- staticcheck
15+
- typecheck
16+
- unused
17+
- bodyclose
118
issues:
219
exclude-rules:
320
- path: api/v1alpha1/groupversion_info.go
421
linters:
522
- gofmt
623
- goimports
24+
# Fix found issues (if it's supported by the linter).
25+
# Default: false
26+
# fix: true
27+
28+
# Maximum count of issues with the same text.
29+
# Set to 0 to disable.
30+
# Default: 3
31+
max-same-issues: 20
32+
33+
output:
34+
# The formats used to render issues.
35+
# Formats:
36+
# - `colored-line-number`
37+
# - `line-number`
38+
# - `json`
39+
# - `colored-tab`
40+
# - `tab`
41+
# - `html`
42+
# - `checkstyle`
43+
# - `code-climate`
44+
# - `junit-xml`
45+
# - `github-actions`
46+
# - `teamcity`
47+
# - `sarif`
48+
# Output path can be either `stdout`, `stderr` or path to the file to write to.
49+
#
50+
# For the CLI flag (`--out-format`), multiple formats can be specified by separating them by comma.
51+
# The output can be specified for each of them by separating format name and path by colon symbol.
52+
# Example: "--out-format=checkstyle:report.xml,json:stdout,colored-line-number"
53+
# The CLI flag (`--out-format`) override the configuration file.
54+
#
55+
# Default:
56+
# formats:
57+
# - format: colored-line-number
58+
# path: stdout
59+
# Print lines of code with issue.
60+
# Default: true
61+
# print-issued-lines: false
62+
# Print linter name in the end of issue text.
63+
# Default: true
64+
# print-linter-name: false
65+
# Sort results by the order defined in `sort-order`.
66+
# Default: false
67+
sort-results: true
68+
# Make issues output unique by line.
69+
# Default: true
70+
uniq-by-line: false
71+
72+
run:
73+
# Timeout for analysis, e.g. 30s, 5m.
74+
# Default: 1m
75+
timeout: 5m

0 commit comments

Comments
 (0)