File tree 5 files changed +54
-0
lines changed
5 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ require (
29
29
github.com/jgautheron/goconst v0.0.0-20201117150253-ccae5bf973f3
30
30
github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a
31
31
github.com/jirfag/go-printf-func-name v0.0.0-20191110105641-45db9963cdd3
32
+ github.com/kunwardeep/paralleltest v1.0.2
32
33
github.com/kyoh86/exportloopref v0.1.8
33
34
github.com/maratori/testpackage v1.0.1
34
35
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 {
324
324
WithPresets (linter .PresetBugs ).
325
325
WithLoadForGoAnalysis ().
326
326
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" ),
327
331
328
332
// nolintlint must be last because it looks at the results of all the previous linters for unused nolint directives
329
333
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