File tree Expand file tree Collapse file tree 5 files changed +54
-0
lines changed Expand file tree Collapse file tree 5 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ require (
2929 github.com/jgautheron/goconst v0.0.0-20201117150253-ccae5bf973f3
3030 github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a
3131 github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3
32+ github.com/kunwardeep/paralleltest v1.0.2
3233 github.com/kyoh86/exportloopref v0.1.8
3334 github.com/maratori/testpackage v1.0.1
3435 github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // v1.0
Original file line number Diff line number Diff line change 1+ package golinters
2+
3+ import (
4+ "github.com/kunwardeep/paralleltest/pkg/paralleltest"
5+ "golang.org/x/tools/go/analysis"
6+
7+ "github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
8+ )
9+
10+ func NewParallelTest () * goanalysis.Linter {
11+ analyzers := []* analysis.Analyzer {
12+ paralleltest .NewAnalyzer (),
13+ }
14+
15+ return goanalysis .NewLinter (
16+ "paralleltest" ,
17+ "paralleltest detects missing usage of t.Parallel() method in your Go test" ,
18+ analyzers ,
19+ nil ,
20+ ).WithLoadMode (goanalysis .LoadModeTypesInfo )
21+ }
Original file line number Diff line number Diff line change @@ -324,6 +324,10 @@ func (m Manager) GetAllSupportedLinterConfigs() []*linter.Config {
324324 WithPresets (linter .PresetBugs ).
325325 WithLoadForGoAnalysis ().
326326 WithURL ("https://github.com/polyfloyd/go-errorlint" ),
327+ linter .NewConfig (golinters .NewParallelTest ()).
328+ WithPresets (linter .PresetStyle ).
329+ WithLoadForGoAnalysis ().
330+ WithURL ("https://github.com/kunwardeep/paralleltest" ),
327331
328332 // nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
329333 linter .NewConfig (golinters .NewNoLintLint ()).
Original file line number Diff line number Diff line change 1+ //args: -Eparalleltest
2+ package testdata
3+
4+ import (
5+ "fmt"
6+ "testing"
7+ )
8+
9+ func TestFunctionSuccessfulRangeTest (t * testing.T ) {
10+ t .Parallel ()
11+
12+ testCases := []struct {
13+ name string
14+ }{{name : "foo" }}
15+ for _ , tc := range testCases {
16+ tc := tc
17+ t .Run (tc .name , func (t * testing.T ) {
18+ t .Parallel ()
19+ fmt .Println (tc .name )
20+ })
21+ }
22+ }
23+
24+ func TestFunctionMissingCallToParallel (t * testing.T ) {} // ERROR "Function TestFunctionMissingCallToParallel missing the call to method parallel"
You can’t perform that action at this time.
0 commit comments