Skip to content

Commit 2113d68

Browse files
committed
ci: enable golangci-lint
Signed-off-by: Ramkumar Chinchani <[email protected]>
1 parent 528a53f commit 2113d68

File tree

2 files changed

+125
-0
lines changed

2 files changed

+125
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: golangci-lint
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
branches:
7+
- main
8+
pull_request:
9+
permissions:
10+
contents: read
11+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
12+
# pull-requests: read
13+
jobs:
14+
golangci:
15+
name: lint
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/setup-go@v5
19+
with:
20+
cache: false
21+
go-version: '1.23'
22+
- uses: actions/checkout@v4
23+
- name: Run linter with GH action
24+
uses: golangci/golangci-lint-action@v6
25+
with:
26+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
27+
version: v1.61.0
28+
29+
# Optional: working directory, useful for monorepos
30+
# working-directory: somedir
31+
32+
# Optional: golangci-lint command line arguments.
33+
# args: --issues-exit-code=0
34+
args: --config ./golangcilint.yaml --enable-all --exclude-files ./pkg/verity/verity.go ./cmd/... ./pkg/...
35+
36+
# Optional: show only new issues if it's a pull request. The default value is `false`.
37+
# only-new-issues: true
38+
39+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
40+
# skip-pkg-cache: true
41+
# skip-pkg-cache: false
42+
43+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
44+
# skip-build-cache: true
45+
- name: Run linter from make target
46+
run: |
47+
make check
48+
- name: Run log linter
49+
run: |
50+
make check-logs

golangcilint.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
run:
2+
timeout: 60m
3+
4+
linters:
5+
enable-all: true
6+
disable:
7+
- gomnd
8+
- funlen
9+
- gocognit
10+
- paralleltest
11+
- forbidigo
12+
- ireturn
13+
- wrapcheck
14+
- exhaustive
15+
- maintidx
16+
- exhaustruct
17+
- rowserrcheck
18+
- sqlclosecheck
19+
- revive
20+
- musttag
21+
- depguard
22+
- execinquery
23+
- inamedparam
24+
- intrange
25+
- promlinter
26+
- protogetter
27+
- contextcheck # needs to revisit: https://github.com/project-zot/zot/pull/2556
28+
- copyloopvar # needs to revisit: https://github.com/project-zot/zot/pull/2556
29+
- typecheck
30+
- exportloopref
31+
32+
linters-settings:
33+
dupl:
34+
threshold: 200
35+
nestif:
36+
min-complexity: 26
37+
cyclop:
38+
max-complexity: 40
39+
skip-tests: true
40+
varnamelen:
41+
check-return: true
42+
ignore-type-assert-ok: true
43+
ignore-map-index-ok: true
44+
ignore-chan-recv-ok: true
45+
ignore-names:
46+
- err
47+
- ok
48+
- gc
49+
- wg
50+
ignore-decls:
51+
- n int
52+
- i int
53+
- r *os.File
54+
- w *os.File
55+
- to int64
56+
gci:
57+
sections:
58+
- standard
59+
- default
60+
wsl:
61+
allow-assign-and-anything: true
62+
force-err-cuddling: true
63+
nolintlint:
64+
allow-unused: true
65+
mnd:
66+
checks:
67+
- argument
68+
- case
69+
- condition
70+
- operation
71+
- return
72+
- assign
73+
ignored-numbers:
74+
- "10"
75+
- "64"

0 commit comments

Comments
 (0)