2019-12-03 08:18:49 -05:00
|
|
|
package stylecheck
|
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/tools/go/analysis"
|
|
|
|
"golang.org/x/tools/go/analysis/passes/inspect"
|
|
|
|
"honnef.co/go/tools/config"
|
|
|
|
"honnef.co/go/tools/facts"
|
2020-05-28 05:02:09 -04:00
|
|
|
"honnef.co/go/tools/internal/passes/buildir"
|
2019-12-03 08:18:49 -05:00
|
|
|
"honnef.co/go/tools/lint/lintutil"
|
|
|
|
)
|
|
|
|
|
2020-05-28 05:02:09 -04:00
|
|
|
var Analyzers = lintutil.InitializeAnalyzers(Docs, map[string]*analysis.Analyzer{
|
2019-12-03 08:18:49 -05:00
|
|
|
"ST1000": {
|
2020-05-28 05:02:09 -04:00
|
|
|
Run: CheckPackageComment,
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1001": {
|
|
|
|
Run: CheckDotImports,
|
|
|
|
Requires: []*analysis.Analyzer{facts.Generated, config.Analyzer},
|
|
|
|
},
|
|
|
|
"ST1003": {
|
|
|
|
Run: CheckNames,
|
2020-05-28 05:02:09 -04:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, config.Analyzer},
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1005": {
|
|
|
|
Run: CheckErrorStrings,
|
2020-05-28 05:02:09 -04:00
|
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer},
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1006": {
|
|
|
|
Run: CheckReceiverNames,
|
2020-05-28 05:02:09 -04:00
|
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer, facts.Generated},
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1008": {
|
|
|
|
Run: CheckErrorReturn,
|
2020-05-28 05:02:09 -04:00
|
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer},
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1011": {
|
2020-05-28 05:02:09 -04:00
|
|
|
Run: CheckTimeNames,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer},
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1012": {
|
|
|
|
Run: CheckErrorVarNames,
|
|
|
|
Requires: []*analysis.Analyzer{config.Analyzer},
|
|
|
|
},
|
|
|
|
"ST1013": {
|
2020-05-28 05:02:09 -04:00
|
|
|
Run: CheckHTTPStatusCodes,
|
|
|
|
// TODO(dh): why does this depend on facts.TokenFile?
|
|
|
|
Requires: []*analysis.Analyzer{facts.Generated, facts.TokenFile, config.Analyzer, inspect.Analyzer},
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1015": {
|
|
|
|
Run: CheckDefaultCaseOrder,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile},
|
|
|
|
},
|
|
|
|
"ST1016": {
|
|
|
|
Run: CheckReceiverNamesIdentical,
|
2020-05-28 05:02:09 -04:00
|
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer, facts.Generated},
|
2019-12-03 08:18:49 -05:00
|
|
|
},
|
|
|
|
"ST1017": {
|
|
|
|
Run: CheckYodaConditions,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated, facts.TokenFile},
|
|
|
|
},
|
|
|
|
"ST1018": {
|
|
|
|
Run: CheckInvisibleCharacters,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer},
|
|
|
|
},
|
2020-05-28 05:02:09 -04:00
|
|
|
"ST1019": {
|
|
|
|
Run: CheckDuplicatedImports,
|
|
|
|
Requires: []*analysis.Analyzer{facts.Generated, config.Analyzer},
|
|
|
|
},
|
|
|
|
"ST1020": {
|
|
|
|
Run: CheckExportedFunctionDocs,
|
|
|
|
Requires: []*analysis.Analyzer{facts.Generated, inspect.Analyzer},
|
|
|
|
},
|
|
|
|
"ST1021": {
|
|
|
|
Run: CheckExportedTypeDocs,
|
|
|
|
Requires: []*analysis.Analyzer{facts.Generated, inspect.Analyzer},
|
|
|
|
},
|
|
|
|
"ST1022": {
|
|
|
|
Run: CheckExportedVarDocs,
|
|
|
|
Requires: []*analysis.Analyzer{facts.Generated, inspect.Analyzer},
|
|
|
|
},
|
|
|
|
})
|