File tree 18 files changed +61
-54
lines changed
18 files changed +61
-54
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ import (
8
8
)
9
9
10
10
func NewAsciicheck () * goanalysis.Linter {
11
+ a := asciicheck .NewAnalyzer ()
12
+
11
13
return goanalysis .NewLinter (
12
- "asciicheck" ,
13
- "Simple linter to check that your code does not contain non-ASCII identifiers" ,
14
- []* analysis.Analyzer {asciicheck . NewAnalyzer () },
14
+ a . Name ,
15
+ a . Doc ,
16
+ []* analysis.Analyzer {a },
15
17
nil ,
16
18
).WithLoadMode (goanalysis .LoadModeSyntax )
17
19
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ func NewBiDiChkFuncName(cfg *config.BiDiChkSettings) *goanalysis.Linter {
51
51
}
52
52
53
53
return goanalysis .NewLinter (
54
- "bidichk" ,
54
+ a . Name ,
55
55
"Checks for dangerous unicode character sequences" ,
56
56
[]* analysis.Analyzer {a },
57
57
cfgMap ,
Original file line number Diff line number Diff line change 8
8
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
9
9
)
10
10
11
- const cyclopName = "cyclop"
12
-
13
11
func NewCyclop (settings * config.Cyclop ) * goanalysis.Linter {
14
12
a := analyzer .NewAnalyzer ()
15
13
@@ -31,7 +29,7 @@ func NewCyclop(settings *config.Cyclop) *goanalysis.Linter {
31
29
}
32
30
33
31
return goanalysis .NewLinter (
34
- cyclopName ,
32
+ a . Name ,
35
33
"checks function and package cyclomatic complexity" ,
36
34
[]* analysis.Analyzer {a },
37
35
cfg ,
Original file line number Diff line number Diff line change @@ -23,10 +23,8 @@ func NewErrChkJSONFuncName(cfg *config.ErrChkJSONSettings) *goanalysis.Linter {
23
23
}
24
24
25
25
return goanalysis .NewLinter (
26
- "errchkjson" ,
27
- "Checks types passed to the json encoding functions. " +
28
- "Reports unsupported types and optionally reports occasions, " +
29
- "where the check for the returned error can be omitted." ,
26
+ a .Name ,
27
+ a .Doc ,
30
28
[]* analysis.Analyzer {a },
31
29
cfgMap ,
32
30
).WithLoadMode (goanalysis .LoadModeTypesInfo )
Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ import (
8
8
)
9
9
10
10
func NewErrName () * goanalysis.Linter {
11
+ a := analyzer .New ()
12
+
11
13
return goanalysis .NewLinter (
12
- "errname" ,
13
- "Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`." ,
14
- []* analysis.Analyzer {analyzer . New () },
14
+ a . Name ,
15
+ a . Doc ,
16
+ []* analysis.Analyzer {a },
15
17
nil ,
16
18
).WithLoadMode (goanalysis .LoadModeTypesInfo )
17
19
}
Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ import (
8
8
)
9
9
10
10
func NewGoPrintfFuncName () * goanalysis.Linter {
11
+ a := analyzer .Analyzer
12
+
11
13
return goanalysis .NewLinter (
12
- "goprintffuncname" ,
13
- "Checks that printf-like functions are named with `f` at the end" ,
14
- []* analysis.Analyzer {analyzer . Analyzer },
14
+ a . Name ,
15
+ a . Doc ,
16
+ []* analysis.Analyzer {a },
15
17
nil ,
16
18
).WithLoadMode (goanalysis .LoadModeSyntax )
17
19
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ func NewGrouper(settings *config.GrouperSettings) *goanalysis.Linter {
25
25
26
26
return goanalysis .NewLinter (
27
27
"grouper" ,
28
- "An analyzer to analyze expression groups." ,
28
+ "Analyze expression groups." ,
29
29
[]* analysis.Analyzer {grouper .New ()},
30
30
linterCfg ,
31
31
).WithLoadMode (goanalysis .LoadModeSyntax )
Original file line number Diff line number Diff line change @@ -19,10 +19,12 @@ func NewIfshort(settings *config.IfshortSettings) *goanalysis.Linter {
19
19
}
20
20
}
21
21
22
+ a := analyzer .Analyzer
23
+
22
24
return goanalysis .NewLinter (
23
- "ifshort" ,
24
- "Checks that your code uses short syntax for if-statements whenever possible" ,
25
- []* analysis.Analyzer {analyzer . Analyzer },
25
+ a . Name ,
26
+ a . Doc ,
27
+ []* analysis.Analyzer {a },
26
28
cfg ,
27
29
).WithLoadMode (goanalysis .LoadModeSyntax )
28
30
}
Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ import (
8
8
)
9
9
10
10
func NewIneffassign () * goanalysis.Linter {
11
+ a := ineffassign .Analyzer
12
+
11
13
return goanalysis .NewLinter (
12
- "ineffassign" ,
14
+ a . Name ,
13
15
"Detects when assignments to existing variables are not used" ,
14
- []* analysis.Analyzer {ineffassign . Analyzer },
16
+ []* analysis.Analyzer {a },
15
17
nil ,
16
18
).WithLoadMode (goanalysis .LoadModeSyntax )
17
19
}
Original file line number Diff line number Diff line change @@ -8,20 +8,18 @@ import (
8
8
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
9
9
)
10
10
11
- const nakedretName = "nakedret"
12
-
13
11
func NewNakedret (settings * config.NakedretSettings ) * goanalysis.Linter {
14
12
var maxLines int
15
13
if settings != nil {
16
14
maxLines = settings .MaxFuncLines
17
15
}
18
16
19
- analyzer := nakedret .NakedReturnAnalyzer (uint (maxLines ))
17
+ a := nakedret .NakedReturnAnalyzer (uint (maxLines ))
20
18
21
19
return goanalysis .NewLinter (
22
- nakedretName ,
23
- "Finds naked returns in functions greater than a specified function length" ,
24
- []* analysis.Analyzer {analyzer },
20
+ a . Name ,
21
+ a . Doc ,
22
+ []* analysis.Analyzer {a },
25
23
nil ,
26
24
).WithLoadMode (goanalysis .LoadModeSyntax )
27
25
}
Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ import (
8
8
)
9
9
10
10
func NewNoctx () * goanalysis.Linter {
11
+ a := noctx .Analyzer
12
+
11
13
return goanalysis .NewLinter (
12
- "noctx" ,
13
- "noctx finds sending http request without context.Context " ,
14
- []* analysis.Analyzer {noctx . Analyzer },
14
+ a . Name ,
15
+ "Detects test helpers which is not start with t.Helper() method " ,
16
+ []* analysis.Analyzer {a },
15
17
nil ,
16
18
).WithLoadMode (goanalysis .LoadModeTypesInfo )
17
19
}
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ func NewParallelTest(settings *config.ParallelTestSettings) *goanalysis.Linter {
22
22
}
23
23
24
24
return goanalysis .NewLinter (
25
- "paralleltest" ,
26
- "paralleltest detects missing usage of t.Parallel() method in your Go test" ,
25
+ a . Name ,
26
+ "Detects missing usage of t.Parallel() method in your Go test" ,
27
27
[]* analysis.Analyzer {a },
28
28
cfg ,
29
29
).WithLoadMode (goanalysis .LoadModeTypesInfo )
Original file line number Diff line number Diff line change @@ -14,12 +14,12 @@ func NewRowsErrCheck(settings *config.RowsErrCheckSettings) *goanalysis.Linter {
14
14
pkgs = settings .Packages
15
15
}
16
16
17
- analyzer := rowserr .NewAnalyzer (pkgs ... )
17
+ a := rowserr .NewAnalyzer (pkgs ... )
18
18
19
19
return goanalysis .NewLinter (
20
- "rowserrcheck" ,
21
- "checks whether Err of rows is checked successfully" ,
22
- []* analysis.Analyzer {analyzer },
20
+ a . Name ,
21
+ "checks whether Rows. Err of rows is checked successfully" ,
22
+ []* analysis.Analyzer {a },
23
23
nil ,
24
24
).WithLoadMode (goanalysis .LoadModeTypesInfo )
25
25
}
Original file line number Diff line number Diff line change @@ -8,12 +8,12 @@ import (
8
8
)
9
9
10
10
func NewSQLCloseCheck () * goanalysis.Linter {
11
+ a := analyzer .NewAnalyzer ()
12
+
11
13
return goanalysis .NewLinter (
12
- "sqlclosecheck" ,
13
- "Checks that sql.Rows and sql.Stmt are closed." ,
14
- []* analysis.Analyzer {
15
- analyzer .NewAnalyzer (),
16
- },
14
+ a .Name ,
15
+ a .Doc ,
16
+ []* analysis.Analyzer {a },
17
17
nil ,
18
18
).WithLoadMode (goanalysis .LoadModeTypesInfo )
19
19
}
Original file line number Diff line number Diff line change @@ -54,8 +54,8 @@ func NewThelper(cfg *config.ThelperSettings) *goanalysis.Linter {
54
54
}
55
55
56
56
return goanalysis .NewLinter (
57
- "thelper" ,
58
- "thelper detects Go test helpers without t.Helper() call and checks the consistency of test helpers" ,
57
+ a . Name ,
58
+ a . Doc ,
59
59
[]* analysis.Analyzer {a },
60
60
cfgMap ,
61
61
).WithLoadMode (goanalysis .LoadModeTypesInfo )
Original file line number Diff line number Diff line change @@ -8,10 +8,11 @@ import (
8
8
)
9
9
10
10
func NewTparallel () * goanalysis.Linter {
11
+ a := tparallel .Analyzer
11
12
return goanalysis .NewLinter (
12
- "tparallel" ,
13
- "tparallel detects inappropriate usage of t.Parallel() method in your Go test codes" ,
14
- []* analysis.Analyzer {tparallel . Analyzer },
13
+ a . Name ,
14
+ a . Doc ,
15
+ []* analysis.Analyzer {a },
15
16
nil ,
16
17
).WithLoadMode (goanalysis .LoadModeTypesInfo )
17
18
}
Original file line number Diff line number Diff line change @@ -8,10 +8,12 @@ import (
8
8
)
9
9
10
10
func NewWastedAssign () * goanalysis.Linter {
11
+ a := wastedassign .Analyzer
12
+
11
13
return goanalysis .NewLinter (
12
- "wastedassign" ,
13
- "wastedassign finds wasted assignment statements. " ,
14
- []* analysis.Analyzer {wastedassign . Analyzer },
14
+ a . Name ,
15
+ "Finds wasted assignment statements" ,
16
+ []* analysis.Analyzer {a },
15
17
nil ,
16
18
).WithLoadMode (goanalysis .LoadModeTypesInfo )
17
19
}
Original file line number Diff line number Diff line change 8
8
"github.com/golangci/golangci-lint/pkg/golinters/goanalysis"
9
9
)
10
10
11
- const wrapcheckName = "wrapcheck"
12
-
13
11
func NewWrapcheck (settings * config.WrapcheckSettings ) * goanalysis.Linter {
14
12
cfg := wrapcheck .NewDefaultConfig ()
15
13
if settings != nil {
@@ -30,7 +28,7 @@ func NewWrapcheck(settings *config.WrapcheckSettings) *goanalysis.Linter {
30
28
a := wrapcheck .NewAnalyzer (cfg )
31
29
32
30
return goanalysis .NewLinter (
33
- wrapcheckName ,
31
+ a . Name ,
34
32
a .Doc ,
35
33
[]* analysis.Analyzer {a },
36
34
nil ,
You can’t perform that action at this time.
0 commit comments