2019-11-07 19:05:39 +00:00
|
|
|
package simple
|
|
|
|
|
|
|
|
import (
|
|
|
|
"golang.org/x/tools/go/analysis"
|
|
|
|
"golang.org/x/tools/go/analysis/passes/inspect"
|
|
|
|
"honnef.co/go/tools/facts"
|
2020-02-26 18:46:17 +00:00
|
|
|
"honnef.co/go/tools/internal/passes/buildir"
|
2019-11-07 19:05:39 +00:00
|
|
|
"honnef.co/go/tools/lint/lintutil"
|
|
|
|
)
|
|
|
|
|
2020-02-26 18:46:17 +00:00
|
|
|
var Analyzers = lintutil.InitializeAnalyzers(Docs, map[string]*analysis.Analyzer{
|
2019-11-07 19:05:39 +00:00
|
|
|
"S1000": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckSingleCaseSelect,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1001": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckLoopCopy,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1002": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckIfBoolCmp,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1003": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckStringsContains,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1004": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckBytesCompare,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1005": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckUnnecessaryBlank,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1006": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckForTrue,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1007": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckRegexpRaw,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1008": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckIfReturn,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1009": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckRedundantNilCheckWithLen,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1010": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckSlicing,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1011": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckLoopAppend,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1012": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckTimeSince,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1016": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckSimplerStructConversion,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1017": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckTrim,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1018": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckLoopSlide,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1019": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckMakeLenCap,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1020": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckAssertNotNil,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1021": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckDeclareAssign,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1023": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckRedundantBreak,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1024": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckTimeUntil,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1025": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckRedundantSprintf,
|
|
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer, inspect.Analyzer, facts.Generated},
|
2019-11-07 19:05:39 +00:00
|
|
|
},
|
|
|
|
"S1028": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckErrorsNewSprintf,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1029": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckRangeStringRunes,
|
|
|
|
Requires: []*analysis.Analyzer{buildir.Analyzer},
|
2019-11-07 19:05:39 +00:00
|
|
|
},
|
|
|
|
"S1030": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckBytesBufferConversions,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1031": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckNilCheckAroundRange,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1032": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckSortHelpers,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1033": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckGuardedDelete,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1034": {
|
2020-02-26 18:46:17 +00:00
|
|
|
Run: CheckSimplifyTypeSwitch,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1035": {
|
|
|
|
Run: CheckRedundantCanonicalHeaderKey,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1036": {
|
|
|
|
Run: CheckUnnecessaryGuard,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer},
|
|
|
|
},
|
|
|
|
"S1037": {
|
|
|
|
Run: CheckElaborateSleep,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1038": {
|
|
|
|
Run: CheckPrintSprintf,
|
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
|
|
|
"S1039": {
|
|
|
|
Run: CheckSprintLiteral,
|
2019-11-07 19:05:39 +00:00
|
|
|
Requires: []*analysis.Analyzer{inspect.Analyzer, facts.Generated},
|
|
|
|
},
|
2020-02-26 18:46:17 +00:00
|
|
|
})
|