@@ -65,63 +65,17 @@ func TestManager_GetOptimizedLinters(t *testing.T) {
65
65
}
66
66
67
67
func TestManager_build (t * testing.T ) {
68
- allMegacheckLinterNames := []string {"gosimple" , "staticcheck" , "unused" }
69
-
70
68
testCases := []struct {
71
69
desc string
72
70
cfg * config.Config
73
71
defaultSet []string // enabled by default linters
74
72
expected []string // alphabetically ordered enabled linter names
75
73
}{
76
- {
77
- desc : "disable all linters from megacheck" ,
78
- cfg : & config.Config {
79
- Linters : config.Linters {
80
- Disable : []string {"megacheck" },
81
- },
82
- },
83
- defaultSet : allMegacheckLinterNames ,
84
- expected : []string {"typecheck" }, // all disabled
85
- },
86
- {
87
- desc : "disable only staticcheck" ,
88
- cfg : & config.Config {
89
- Linters : config.Linters {
90
- Disable : []string {"staticcheck" },
91
- },
92
- },
93
- defaultSet : allMegacheckLinterNames ,
94
- expected : []string {"gosimple" , "typecheck" , "unused" },
95
- },
96
- {
97
- desc : "don't merge into megacheck" ,
98
- defaultSet : allMegacheckLinterNames ,
99
- expected : []string {"gosimple" , "staticcheck" , "typecheck" , "unused" },
100
- },
101
- {
102
- desc : "expand megacheck" ,
103
- cfg : & config.Config {
104
- Linters : config.Linters {
105
- Enable : []string {"megacheck" },
106
- },
107
- },
108
- defaultSet : nil ,
109
- expected : []string {"gosimple" , "staticcheck" , "typecheck" , "unused" },
110
- },
111
74
{
112
75
desc : "don't disable anything" ,
113
76
defaultSet : []string {"gofmt" , "govet" , "typecheck" },
114
77
expected : []string {"gofmt" , "govet" , "typecheck" },
115
78
},
116
- {
117
- desc : "enable gosec by gas alias" ,
118
- cfg : & config.Config {
119
- Linters : config.Linters {
120
- Enable : []string {"gas" },
121
- },
122
- },
123
- expected : []string {"gosec" , "typecheck" },
124
- },
125
79
{
126
80
desc : "enable gosec by primary name" ,
127
81
cfg : & config.Config {
@@ -131,25 +85,6 @@ func TestManager_build(t *testing.T) {
131
85
},
132
86
expected : []string {"gosec" , "typecheck" },
133
87
},
134
- {
135
- desc : "enable gosec by both names" ,
136
- cfg : & config.Config {
137
- Linters : config.Linters {
138
- Enable : []string {"gosec" , "gas" },
139
- },
140
- },
141
- expected : []string {"gosec" , "typecheck" },
142
- },
143
- {
144
- desc : "disable gosec by gas alias" ,
145
- cfg : & config.Config {
146
- Linters : config.Linters {
147
- Disable : []string {"gas" },
148
- },
149
- },
150
- defaultSet : []string {"gosec" },
151
- expected : []string {"typecheck" },
152
- },
153
88
{
154
89
desc : "disable gosec by primary name" ,
155
90
cfg : & config.Config {
0 commit comments