-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paul Balogh <[email protected]>
- Loading branch information
Showing
3 changed files
with
168 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
check-modules: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Install Go(lang) | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
- name: Check module dependencies | ||
run: | | ||
go version | ||
test -z "$(go mod tidy && git status go.* --porcelain)" | ||
go mod verify | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version: 1.21.x | ||
- name: Retrieve golangci-lint version | ||
run: | | ||
echo "Version=$(head -n 1 "${GITHUB_WORKSPACE}/.golangci.yml" | tr -d '# ')" >> $GITHUB_OUTPUT | ||
id: version | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: ${{ steps.version.outputs.Version }} | ||
only-new-issues: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# v1.55.2 | ||
# Please don't remove the first line. It is used in CI to determine the golangci-lint version | ||
run: | ||
deadline: 5m | ||
|
||
issues: | ||
# Maximum issues count per one linter. Set to 0 to disable. Default is 50. | ||
max-issues-per-linter: 0 | ||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3. | ||
max-same-issues: 0 | ||
|
||
# We want to try and improve the comments in the k6 codebase, so individual | ||
# non-golint items from the default exclusion list will gradually be added | ||
# to the exclude-rules below | ||
exclude-use-default: false | ||
|
||
exclude-rules: | ||
# Exclude duplicate code and function length and complexity checking in test | ||
# files (due to common repeats and long functions in test code) | ||
- path: _(test|gen)\.go | ||
linters: | ||
- cyclop | ||
- dupl | ||
- gocognit | ||
- funlen | ||
- lll | ||
- linters: | ||
- forbidigo | ||
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden' | ||
|
||
linters-settings: | ||
nolintlint: | ||
# Disable to ensure that nolint directives don't have a leading space. Default is true. | ||
allow-leading-space: false | ||
exhaustive: | ||
default-signifies-exhaustive: true | ||
govet: | ||
check-shadowing: true | ||
cyclop: | ||
max-complexity: 25 | ||
maligned: | ||
suggest-new: true | ||
dupl: | ||
threshold: 150 | ||
goconst: | ||
min-len: 10 | ||
min-occurrences: 4 | ||
funlen: | ||
lines: 80 | ||
statements: 60 | ||
forbidigo: | ||
forbid: | ||
- '^(fmt\\.Print(|f|ln)|print|println)$' | ||
# Forbid everything in os, except os.Signal and os.SyscalError | ||
- '^os\.(.*)$(# Using anything except Signal and SyscallError from the os package is forbidden )?' | ||
# Forbid everything in syscall except the uppercase constants | ||
- '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?' | ||
- '^logrus\.Logger$' | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- asasalint | ||
- asciicheck | ||
- bidichk | ||
- bodyclose | ||
- contextcheck | ||
- cyclop | ||
- dogsled | ||
- dupl | ||
- durationcheck | ||
- errcheck | ||
- errchkjson | ||
- errname | ||
- errorlint | ||
- exhaustive | ||
- exportloopref | ||
- forbidigo | ||
- forcetypeassert | ||
- funlen | ||
- gocheckcompilerdirectives | ||
- gochecknoglobals | ||
- gocognit | ||
- goconst | ||
- gocritic | ||
- gofmt | ||
- gofumpt | ||
- goimports | ||
- gomoddirectives | ||
- goprintffuncname | ||
- gosec | ||
- gosimple | ||
- govet | ||
- importas | ||
- ineffassign | ||
- interfacebloat | ||
- lll | ||
- makezero | ||
- misspell | ||
- nakedret | ||
- nestif | ||
- nilerr | ||
- nilnil | ||
- noctx | ||
- nolintlint | ||
- nosprintfhostport | ||
- paralleltest | ||
- prealloc | ||
- predeclared | ||
- promlinter | ||
- revive | ||
- reassign | ||
- rowserrcheck | ||
- sqlclosecheck | ||
- staticcheck | ||
- stylecheck | ||
- tenv | ||
- tparallel | ||
- typecheck | ||
- unconvert | ||
- unparam | ||
- unused | ||
- usestdlibvars | ||
- wastedassign | ||
- whitespace | ||
fast: false |