Skip to content
This repository was archived by the owner on Oct 24, 2024. It is now read-only.

Commit 11eb454

Browse files
authored
Fix unit testing and code quality pipeline (#8)
1 parent e7d1b3e commit 11eb454

2 files changed

Lines changed: 56 additions & 9 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,24 @@ jobs:
1616
runs-on: ubuntu-latest
1717
strategy:
1818
matrix:
19-
go-version: ['1.21', '1.22']
19+
go-version: ['1.22', '1.21']
2020

2121
steps:
2222
- name: Checkout code into go module directory
2323
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
2426

2527
- name: Set up Go ${{ matrix.go-version }}
26-
uses: actions/setup-go@v4
28+
uses: actions/setup-go@v5
2729
with:
2830
go-version: ${{ matrix.go-version }}
2931
id: Go
3032

3133
- name: Get dependencies
3234
run: |
3335
go mod download
36+
go mod tidy
3437
3538
- name: Test
3639
run: |
@@ -59,5 +62,5 @@ jobs:
5962
- name: golangci-lint
6063
uses: golangci/golangci-lint-action@v3
6164
with:
62-
version: v1.57.2
65+
version: v1.59.1
6366
args: --timeout=9m

.golangci.yml

Lines changed: 50 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
linters-settings:
23
dupl:
34
threshold: 100
@@ -8,7 +9,9 @@ linters-settings:
89
statements: 50
910
gci:
1011
sections:
11-
- prefix(kops.dev)
12+
- standard
13+
- default
14+
- localmodule
1215
goconst:
1316
min-len: 2
1417
min-occurrences: 2
@@ -28,10 +31,10 @@ linters-settings:
2831
gocyclo:
2932
min-complexity: 10
3033
goimports:
31-
local-prefixes: kops.dev
34+
local-prefixes: github.com/golangci/golangci-lint
3235
golint:
3336
min-confidence: 0
34-
gomnd:
37+
mnd:
3538
checks:
3639
- argument
3740
- case
@@ -40,6 +43,11 @@ linters-settings:
4043
govet:
4144
enable:
4245
- shadow
46+
settings:
47+
printf:
48+
funcs:
49+
- (gofr.dev/pkg/gofr/Logger).Logf
50+
- (gofr.dev/pkg/gofr/Logger).Errorf
4351
lll:
4452
line-length: 140
4553
maligned:
@@ -50,6 +58,38 @@ linters-settings:
5058
allow-unused: false # report any unused nolint directives
5159
require-explanation: true # require an explanation for nolint directives
5260
require-specific: true # require nolint directives to be specific about which linter is being skipped
61+
revive:
62+
rules:
63+
# default revive rules, they have to be present otherwise they are disabled
64+
- name: blank-imports
65+
- name: context-as-argument
66+
- name: context-keys-type
67+
- name: dot-imports
68+
- name: empty-block
69+
- name: error-naming
70+
- name: error-return
71+
- name: error-strings
72+
- name: errorf
73+
- name: increment-decrement
74+
- name: indent-error-flow
75+
- name: range
76+
- name: receiver-naming
77+
- name: redefines-builtin-id
78+
- name: superfluous-else
79+
- name: time-naming
80+
- name: unexported-return
81+
- name: unreachable-code
82+
- name: unused-parameter
83+
- name: var-declaration
84+
- name: var-naming
85+
# additional revive rules
86+
- name: bare-return
87+
- name: bool-literal-in-expr
88+
- name: comment-spacings
89+
- name: early-return
90+
- name: defer
91+
- name: deep-exit
92+
- name: unused-receiver
5393

5494
linters:
5595
# please, do not use `enable-all`: it's deprecated and will be removed soon.
@@ -60,7 +100,9 @@ linters:
60100
- bodyclose
61101
- dogsled
62102
- dupl
103+
- err113
63104
- errcheck
105+
- errorlint
64106
- exhaustive
65107
- exportloopref
66108
- funlen
@@ -71,17 +113,17 @@ linters:
71113
- gocritic
72114
- gocyclo
73115
- godot
74-
- goerr113
75116
- gofmt
76117
- goimports
77-
- gomnd
78118
- goprintffuncname
79119
- gosec
80120
- gosimple
81121
- govet
82122
- ineffassign
83123
- lll
124+
- mirror
84125
- misspell
126+
- mnd
85127
- nakedret
86128
- nestif
87129
- noctx
@@ -91,9 +133,11 @@ linters:
91133
- rowserrcheck
92134
- staticcheck
93135
- stylecheck
136+
- thelper
94137
- unconvert
95138
- unparam
96139
- unused
140+
- usestdlibvars
97141
- whitespace
98142
- wsl
99143

@@ -103,7 +147,7 @@ linters:
103147

104148

105149
service:
106-
golangci-lint-version: 1.58.x
150+
golangci-lint-version: 1.59.x
107151

108152
issues:
109153
# exclude-use-default: false

0 commit comments

Comments
 (0)