Skip to content

Commit

Permalink
Update linting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiade committed Dec 11, 2023
1 parent 0c981b3 commit 8efc74c
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 43 deletions.
128 changes: 86 additions & 42 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# v1.47.2
# Please don't remove the first line. It uses in CI to determine the golangci version
run:
deadline: 5m

Expand All @@ -10,13 +8,13 @@ issues:
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 addded
# 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)
# 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
Expand All @@ -25,13 +23,10 @@ issues:
- funlen
- lll
- linters:
- paralleltest # false positive: https://github.com/kunwardeep/paralleltest/issues/8.
text: "does not use range value in test Run"
- staticcheck # Tracked in https://github.com/grafana/xk6-grpc/issues/14
text: "The entire proto file grpc/reflection/v1alpha/reflection.proto is marked as deprecated."

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:
Expand All @@ -48,37 +43,86 @@ linters-settings:
funlen:
lines: 80
statements: 60
forbidigo:
forbid:
- '^(fmt\\.Print(|f|ln)|print|println)$'
# Forbid everything in syscall except the uppercase constants
- '^syscall\.[^A-Z_]+$(# Using anything except constants from the syscall package is forbidden )?'
- '^logrus\.Logger$'
revive:
rules:
- name: package-comments
severity: warning
disabled: true
stylecheck:
checks:
- "all"
- '-ST1000' # Use of underscores in Go names

linters:
enable-all: true
disable:
- nlreturn
- gci
- gochecknoinits
- godot
- godox
- gomodguard
- testpackage
- wsl
- gomnd
- goerr113 # most of the errors here are meant for humans
- goheader
- exhaustivestruct
- thelper
- gocyclo # replaced by cyclop since it also calculates the package complexity
- maligned # replaced by govet 'fieldalignment'
- interfacer # deprecated
- scopelint # deprecated, replaced by exportloopref
- wrapcheck # a little bit too much for k6, maybe after https://github.com/tomarrell/wrapcheck/issues/2 is fixed
- golint # this linter is deprecated
- varnamelen
- ireturn
- tagliatelle
- exhaustruct
- execinquery
- maintidx
- grouper
- decorder
- nonamedreturns
- nosnakecase
fast: false
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
2 changes: 1 addition & 1 deletion characters.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func HexDigit1[I Bytes]() Parser[I, I] {
}
}

// WhiteSpace0 parses zero or more whitespace characters: ' ', '\t', '\n', '\r'.
// Whitespace0 parses zero or more whitespace characters: ' ', '\t', '\n', '\r'.
// In the cases where the input is empty, or no terminating character is found, the parser
// returns the input as is.
func Whitespace0[I Bytes]() Parser[I, I] {
Expand Down

0 comments on commit 8efc74c

Please sign in to comment.