golangci-lint/pkg/golinters/paralleltest.go
Oleksandr Redko ce020c6be1
dev: use analyzer fields for name, doc instead of hardcoded strings (#4214)
Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
2023-11-20 20:53:18 +01:00

31 lines
767 B
Go

package golinters
import (
"github.com/kunwardeep/paralleltest/pkg/paralleltest"
"golang.org/x/tools/go/analysis"
"github.com/golangci/golangci-lint/pkg/config"
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
)
func NewParallelTest(settings *config.ParallelTestSettings) *goanalysis.Linter {
a := paralleltest.NewAnalyzer()
var cfg map[string]map[string]any
if settings != nil {
cfg = map[string]map[string]any{
a.Name: {
"i": settings.IgnoreMissing,
"ignoremissingsubtests": settings.IgnoreMissingSubtests,
},
}
}
return goanalysis.NewLinter(
a.Name,
"Detects missing usage of t.Parallel() method in your Go test",
[]*analysis.Analyzer{a},
cfg,
).WithLoadMode(goanalysis.LoadModeTypesInfo)
}