Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Copy .golangci.yml from k6 repo
  • Loading branch information
mstoykov committed Dec 11, 2024
commit 662d5c324ac7f02b6177572ca1802823a2fd3a14
128 changes: 74 additions & 54 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,76 @@
# v1.55.2
# Please don't remove the first line. It's used in CI to determine the
# golangci-lint version. See the lint step in .github/workflows/all.yaml
# v1.60.1
# Please don't remove the first line. It uses in CI to determine the golangci version
run:
timeout: 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

# Disable default exclude rules, see `golangci-lint run --help`.
# When true it disables revive's comment warnings, and we want them enabled.
# 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:
- path: (.+)_test.go
linters:
- wrapcheck
- funlen
- cyclop
- path: k6ext/k6test
linters:
- wrapcheck
- funlen
- cyclop
- path: tests
linters:
- wrapcheck
- funlen
- cyclop
# 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:
- canonicalheader
- cyclop
- dupl
- gocognit
- funlen
- lll
- forcetypeassert
- path: js\/modules\/k6\/html\/.*\.go
text: "exported: exported "
linters:
- revive
- path: js\/modules\/k6\/http\/.*_test\.go
linters:
# k6/http module's tests are quite complex because they often have several nested levels.
# The module is in maintenance mode, so we don't intend to port the tests to a parallel version.
- paralleltest
- tparallel
- linters:
- forbidigo
text: 'use of `os\.(SyscallError|Signal|Interrupt)` forbidden'

linters-settings:
exhaustive:
default-signifies-exhaustive: true
cyclop:
max-complexity: 25
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
- canonicalheader
- contextcheck
- cyclop
- dogsled
- dupl
Expand All @@ -45,69 +81,53 @@ linters:
- errorlint
- exhaustive
- exportloopref
- fatcontext
- forbidigo
- forcetypeassert
- funlen
- gci
- gocheckcompilerdirectives
- gochecknoglobals
- gocognit
- goconst
- gocritic
- godot
- gofmt
- gofumpt
- goimports
- gomoddirectives
- goprintffuncname
- gosec
- gosimple
- govet
- importas
- ineffassign
- interfacebloat
- lll
- makezero
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
- predeclared
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- revive
- reassign
- rowserrcheck
- sqlclosecheck
- staticcheck
- tagliatelle
- thelper
- stylecheck
- tenv
- tparallel
- typecheck
- unconvert
- unparam
- unused
- usestdlibvars
- wastedassign
- whitespace
- wrapcheck

linters-settings:
gci:
sections:
- standard
- prefix(github.com/grafana/xk6-browser)
- prefix(go.k6.io)
- default
dupl:
threshold: 400
gofmt:
simplify: true
goimports:
local-prefixes: github.com/grafana/xk6-browser
importas:
alias:
- pkg: go.k6.io/k6/.*/(\w+)
alias: k6$1
nlreturn:
block-size: 10
lll:
maxlength: 120
gosec:
config:
G301: '0755'
G306: '0644'
fast: false