2019-04-24 05:18:40 -07:00
|
|
|
run:
|
2023-04-09 00:08:40 -07:00
|
|
|
timeout: 15m
|
2021-10-22 01:26:56 -07:00
|
|
|
skip-files:
|
|
|
|
# Skip autogenerated files.
|
|
|
|
- ^.*\.(pb|y)\.go$
|
2023-07-28 03:35:28 -07:00
|
|
|
skip-dirs:
|
|
|
|
# Copied it from a different source
|
|
|
|
- storage/remote/otlptranslator/prometheusremotewrite
|
2023-11-15 06:30:09 -08:00
|
|
|
- storage/remote/otlptranslator/prometheus
|
2019-04-24 05:18:40 -07:00
|
|
|
|
2021-11-10 01:29:12 -08:00
|
|
|
output:
|
|
|
|
sort-results: true
|
|
|
|
|
2020-03-23 07:32:37 -07:00
|
|
|
linters:
|
|
|
|
enable:
|
2021-06-12 03:47:47 -07:00
|
|
|
- depguard
|
2023-09-27 14:34:18 -07:00
|
|
|
- errorlint
|
2023-04-09 00:08:40 -07:00
|
|
|
- gocritic
|
2023-10-03 13:09:25 -07:00
|
|
|
- godot
|
2021-10-22 01:27:37 -07:00
|
|
|
- gofumpt
|
|
|
|
- goimports
|
2022-03-03 09:11:19 -08:00
|
|
|
- misspell
|
2023-10-31 04:35:13 -07:00
|
|
|
- nolintlint
|
2023-05-21 00:20:07 -07:00
|
|
|
- predeclared
|
|
|
|
- revive
|
2023-12-07 03:35:01 -08:00
|
|
|
- testifylint
|
2023-04-09 00:08:40 -07:00
|
|
|
- unconvert
|
|
|
|
- unused
|
2024-04-08 12:26:23 -07:00
|
|
|
- usestdlibvars
|
2024-04-11 01:27:54 -07:00
|
|
|
- whitespace
|
2020-03-23 07:32:37 -07:00
|
|
|
|
2019-05-03 06:11:28 -07:00
|
|
|
issues:
|
2022-04-27 02:24:36 -07:00
|
|
|
max-same-issues: 0
|
2019-05-03 06:11:28 -07:00
|
|
|
exclude-rules:
|
2023-04-09 00:08:40 -07:00
|
|
|
- linters:
|
|
|
|
- gocritic
|
|
|
|
text: "appendAssign"
|
2021-06-12 03:47:47 -07:00
|
|
|
- path: _test.go
|
|
|
|
linters:
|
|
|
|
- errcheck
|
2023-11-16 10:54:41 -08:00
|
|
|
- path: "tsdb/head_wal.go"
|
2023-09-27 14:34:18 -07:00
|
|
|
linters:
|
|
|
|
- errorlint
|
2023-10-03 13:09:25 -07:00
|
|
|
- linters:
|
|
|
|
- godot
|
|
|
|
source: "^// ==="
|
2019-05-03 06:11:28 -07:00
|
|
|
|
|
|
|
linters-settings:
|
2020-08-21 02:37:21 -07:00
|
|
|
depguard:
|
2023-06-27 04:51:29 -07:00
|
|
|
rules:
|
|
|
|
main:
|
|
|
|
deny:
|
2024-03-20 20:32:02 -07:00
|
|
|
- pkg: "sync/atomic"
|
|
|
|
desc: "Use go.uber.org/atomic instead of sync/atomic"
|
|
|
|
- pkg: "github.com/stretchr/testify/assert"
|
|
|
|
desc: "Use github.com/stretchr/testify/require instead of github.com/stretchr/testify/assert"
|
|
|
|
- pkg: "github.com/go-kit/kit/log"
|
|
|
|
desc: "Use github.com/go-kit/log instead of github.com/go-kit/kit/log"
|
|
|
|
- pkg: "io/ioutil"
|
|
|
|
desc: "Use corresponding 'os' or 'io' functions instead."
|
|
|
|
- pkg: "regexp"
|
|
|
|
desc: "Use github.com/grafana/regexp instead of regexp"
|
|
|
|
- pkg: "github.com/pkg/errors"
|
|
|
|
desc: "Use 'errors' or 'fmt' instead of github.com/pkg/errors"
|
|
|
|
- pkg: "gzip"
|
|
|
|
desc: "Use github.com/klauspost/compress instead of gzip"
|
|
|
|
- pkg: "zlib"
|
|
|
|
desc: "Use github.com/klauspost/compress instead of zlib"
|
|
|
|
- pkg: "golang.org/x/exp/slices"
|
|
|
|
desc: "Use 'slices' instead."
|
2019-05-03 06:11:28 -07:00
|
|
|
errcheck:
|
2023-04-03 00:05:10 -07:00
|
|
|
exclude-functions:
|
|
|
|
# Don't flag lines such as "io.Copy(io.Discard, resp.Body)".
|
|
|
|
- io.Copy
|
|
|
|
# The next two are used in HTTP handlers, any error is handled by the server itself.
|
|
|
|
- io.WriteString
|
|
|
|
- (net/http.ResponseWriter).Write
|
|
|
|
# No need to check for errors on server's shutdown.
|
|
|
|
- (*net/http.Server).Shutdown
|
|
|
|
# Never check for logger errors.
|
|
|
|
- (github.com/go-kit/log.Logger).Log
|
|
|
|
# Never check for rollback errors as Rollback() is called when a previous error was detected.
|
|
|
|
- (github.com/prometheus/prometheus/storage.Appender).Rollback
|
2021-10-22 01:27:37 -07:00
|
|
|
goimports:
|
|
|
|
local-prefixes: github.com/prometheus/prometheus
|
|
|
|
gofumpt:
|
|
|
|
extra-rules: true
|
2023-04-04 01:28:19 -07:00
|
|
|
revive:
|
2023-11-29 09:23:34 -08:00
|
|
|
# By default, revive will enable only the linting rules that are named in the configuration file.
|
|
|
|
# So, it's needed to explicitly set in configuration all required rules.
|
|
|
|
# The following configuration enables all the rules from the defaults.toml
|
|
|
|
# https://github.com/mgechev/revive/blob/master/defaults.toml
|
2023-04-04 01:28:19 -07:00
|
|
|
rules:
|
2023-11-29 09:23:34 -08:00
|
|
|
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
|
|
|
|
- name: blank-imports
|
|
|
|
- name: context-as-argument
|
|
|
|
arguments:
|
|
|
|
# allow functions with test or bench signatures
|
|
|
|
- allowTypesBefore: "*testing.T,testing.TB"
|
|
|
|
- name: context-keys-type
|
|
|
|
- name: dot-imports
|
|
|
|
# A lot of false positives: incorrectly identifies channel draining as "empty code block".
|
|
|
|
# See https://github.com/mgechev/revive/issues/386
|
|
|
|
- name: empty-block
|
|
|
|
disabled: true
|
|
|
|
- name: error-naming
|
|
|
|
- name: error-return
|
|
|
|
- name: error-strings
|
|
|
|
- name: errorf
|
|
|
|
- name: exported
|
|
|
|
- name: increment-decrement
|
|
|
|
- name: indent-error-flow
|
|
|
|
- name: package-comments
|
|
|
|
- name: range
|
|
|
|
- name: receiver-naming
|
|
|
|
- name: redefines-builtin-id
|
|
|
|
- name: superfluous-else
|
|
|
|
- name: time-naming
|
|
|
|
- name: unexported-return
|
|
|
|
- name: unreachable-code
|
2023-04-04 01:28:19 -07:00
|
|
|
- name: unused-parameter
|
|
|
|
disabled: true
|
2023-11-29 09:23:34 -08:00
|
|
|
- name: var-declaration
|
|
|
|
- name: var-naming
|
2023-12-07 03:35:01 -08:00
|
|
|
testifylint:
|
|
|
|
disable:
|
|
|
|
- float-compare
|
|
|
|
- go-require
|
|
|
|
enable:
|
|
|
|
- bool-compare
|
|
|
|
- compares
|
|
|
|
- empty
|
|
|
|
- error-is-as
|
|
|
|
- error-nil
|
|
|
|
- expected-actual
|
|
|
|
- len
|
|
|
|
- require-error
|
|
|
|
- suite-dont-use-pkg
|
|
|
|
- suite-extra-assert-call
|