2025-04-10 20:42:23 +08:00
# This file is best edited with some JSON-schema-aware editor.
# VSCode/Cursor/... user? See: https://github.com/redhat-developer/vscode-yaml
# Others can set up the YAML LSP manually, which supports schemas: https://github.com/redhat-developer/yaml-language-server
# $schema: https://golangci-lint.run/jsonschema/golangci.jsonschema.json
version : "2"
2024-11-26 16:19:53 +08:00
run :
2025-02-19 00:00:30 +08:00
timeout : 15m
2024-11-26 16:19:53 +08:00
concurrency : 10
allow-parallel-runners : true
linters :
2025-04-10 20:42:23 +08:00
default : none
2024-11-26 16:19:53 +08:00
enable :
- asciicheck
- bodyclose
- depguard
- dogsled
- errcheck
- errorlint
- exhaustive
- gocyclo
- goprintffuncname
- gosec
- govet
- ineffassign
- misspell
- nakedret
- prealloc
- revive
- staticcheck
- unconvert
- unused
- whitespace
2025-04-10 20:42:23 +08:00
settings :
depguard :
rules :
aggregator :
list-mode : lax
files :
- ./pkg/aggregator/*
- ./pkg/aggregator/**/*
allow :
- github.com/grafana/grafana/pkg/aggregator
- github.com/grafana/grafana/pkg/semconv
- github.com/grafana/grafana/pkg/apimachinery
deny :
- pkg : github.com/grafana/grafana/pkg
desc : apimachinery is not allowed to import grafana core
apimachinery :
list-mode : lax
files :
- '**/pkg/apimachinery/*'
- '**/pkg/apimachinery/**/*'
allow :
- github.com/grafana/grafana/pkg/apimachinery
deny :
- pkg : github.com/grafana/grafana/pkg
desc : apimachinery is not allowed to import grafana core
apiserver :
list-mode : lax
files :
- '**/pkg/apiserver/*'
- '**/pkg/apiserver/**/*'
allow :
- github.com/grafana/grafana/pkg/apimachinery
- github.com/grafana/grafana/pkg/apiserver
deny :
- pkg : github.com/grafana/grafana/pkg
desc : apiserver is not allowed to import grafana core
apps-investigation :
list-mode : lax
files :
- ./apps/investigations/*
- ./apps/investigations/**/*
deny :
- pkg : github.com/grafana/grafana/pkg
desc : apps/investigations is not allowed to import grafana core
apps-playlist :
list-mode : lax
files :
- ./apps/playlist/*
- ./apps/playlist/**/*
deny :
- pkg : github.com/grafana/grafana/pkg
desc : apps/playlist is not allowed to import grafana core
2025-07-11 19:42:46 +08:00
apps-secret :
list-mode : lax
files :
- ./apps/secret/*
- ./apps/secret/**/*
deny :
- pkg : github.com/grafana/grafana/pkg
desc : apps/secret is not allowed to import grafana core
2025-04-10 20:42:23 +08:00
coreplugins :
files :
- '**/pkg/tsdb/grafana-pyroscope-datasource/*'
- '**/pkg/tsdb/grafana-pyroscope-datasource/**/*'
- '**/pkg/tsdb/grafana-testdata-datasource/*'
- '**/pkg/tsdb/grafana-testdata-datasource/**/*'
- '**/pkg/tsdb/azuremonitor/*'
- '**/pkg/tsdb/azuremonitor/**/*'
- '**/pkg/tsdb/cloud-monitoring/*'
- '**/pkg/tsdb/cloud-monitoring/**/*'
2025-09-11 01:48:29 +08:00
- '**/pkg/tsdb/graphite/*'
- '**/pkg/tsdb/graphite/**/*'
2025-04-10 20:42:23 +08:00
- '**/pkg/tsdb/mysql/*'
- '**/pkg/tsdb/mysql/**/*'
- '**/pkg/tsdb/parca/*'
- '**/pkg/tsdb/parca/**/*'
- '**/pkg/tsdb/tempo/*'
- '**/pkg/tsdb/tempo/**/*'
- '**/pkg/tsdb/cloudwatch/*'
- '**/pkg/tsdb/cloudwatch/**/*'
2025-06-27 21:09:45 +08:00
- '**/pkg/tsdb/loki/*'
- '**/pkg/tsdb/loki/**/*'
2025-07-01 16:58:00 +08:00
- '**/pkg/tsdb/zipkin/*'
- '**/pkg/tsdb/zipkin/**/*'
2025-07-01 16:36:35 +08:00
- '**/pkg/tsdb/jaeger/*'
- '**/pkg/tsdb/jaeger/**/*'
2025-04-10 20:42:23 +08:00
deny :
- pkg : github.com/grafana/grafana/pkg/api
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/cmd
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/cuectx
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/extensions
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/kinds
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/middleware
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/modules
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/registry
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/services
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/build
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/codegen
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/events
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/ifaces
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/kindsysreport
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/mocks
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/plugins
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/setting
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/util
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/bus
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/components
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/expr
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/infra
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/login
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/models
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/server
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/tests
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/web
desc : Core plugins are not allowed to depend on Grafana core packages
- pkg : github.com/grafana/grafana/pkg/tsdb/intervalv2
desc : Core plugins are not allowed to depend on Grafana core packages
main :
deny :
- pkg : io/ioutil
desc: 'Deprecated : As of Go 1.16, the same functionality is now provided by package io or package os, and those implementations should be preferred in new code. See the specific function documentation for details.'
- pkg : gopkg.in/yaml.v2
desc : Grafana packages are not allowed to depend on gopkg.in/yaml.v2 as gopkg.in/yaml.v3 is now available
- pkg : github.com/pkg/errors
desc: 'Deprecated : Go 1.13 supports the functionality provided by pkg/errors in the standard library.'
- pkg : github.com/xorcare/pointer
desc : Use pkg/util.Pointer instead, which is a generic one-liner alternative
- pkg : github.com/gofrs/uuid
desc : Use github.com/google/uuid instead, which we already depend on.
- pkg : github.com/bmizerany/assert
desc : Use github.com/stretchr/testify/assert instead, which we already depend on.
promlib :
list-mode : lax
files :
- '**/pkg/promlib/**/*'
allow :
- github.com/grafana/grafana/pkg/promlib
deny :
- pkg : github.com/grafana/grafana/pkg
desc : promlib is not allowed to import grafana core
storage-unified-apistore :
list-mode : lax
files :
- ./pkg/storage/unified/apistore/*
- ./pkg/storage/unified/apistore/**/*
allow :
- github.com/grafana/grafana/pkg/apimachinery
- github.com/grafana/grafana/pkg/apiserver
- github.com/grafana/grafana/pkg/unified/resource
deny :
- pkg : github.com/grafana/grafana/pkg
desc : pkg/storage/unified/apistore is not allowed to import grafana core
storage-unified-resource :
list-mode : lax
files :
- ./pkg/storage/unified/resource/*
- ./pkg/storage/unified/resource/**/*
allow :
- github.com/grafana/grafana/pkg/apimachinery
deny :
- pkg : github.com/grafana/grafana/pkg
desc : pkg/storage/unified/resource is not allowed to import grafana core
exhaustive :
default-signifies-exhaustive : true
gocritic :
enabled-checks :
- ruleguard
settings :
ruleguard :
rules : pkg/ruleguard.rules.go
misspell :
ignore-rules :
- Unknwon
- Creater
nakedret :
max-func-lines : 60
revive :
confidence : 3
severity : warning
exclusions :
generated : lax
rules :
- linters :
- staticcheck
text : ST1003
- linters :
- staticcheck
text : ST1001
- linters :
- staticcheck
text: 'SA1019 : http.CloseNotifier'
- linters :
- staticcheck
text: 'SA1019 : strings.Title'
- linters :
- staticcheck
text: 'SA1019 : "go.opentelemetry.io/otel/exporters/jaeger" '
- linters :
- staticcheck
text : use fake service and real access control evaluator instead
- linters :
- gosec
text : G108
- linters :
- gosec
text : G110
- linters :
- gosec
text : G115
- linters :
- gosec
text : G201
- linters :
- gosec
text : G202
- linters :
- gosec
text : G306
- linters :
- gosec
text : "401"
- linters :
- gosec
text : "402"
- linters :
- gosec
text : "501"
- linters :
- gosec
text : "404"
- linters :
- errorlint
text : non-wrapping format verb for fmt.Errorf
- linters :
- staticcheck
text : ST1000
- linters :
- staticcheck
text : ST1020
- linters :
- staticcheck
text : ST1021
- linters :
- gosec
path : (.+)_test\.go
text : G601
paths :
- devenv
- scripts
- third_party$
- builtin$
- examples$
2025-05-02 23:13:01 +08:00
- pkg/util/xorm
2024-11-26 16:19:53 +08:00
issues :
max-same-issues : 0
2025-04-10 20:42:23 +08:00
formatters :
enable :
- goimports
exclusions :
generated : lax
paths :
- devenv
- scripts
- third_party$
- builtin$
- examples$