File tree Expand file tree Collapse file tree 3 files changed +6
-28
lines changed Expand file tree Collapse file tree 3 files changed +6
-28
lines changed Original file line number Diff line number Diff line change @@ -149,22 +149,7 @@ var defRuleConf = map[string]lint.RuleConfig{
149
149
},
150
150
}
151
151
152
- // GetDefaultConfig writes default config to given file
153
- func GetDefaultConfig (onlyEnabled bool ) * lint.Config {
154
- if ! onlyEnabled {
155
- return defConf
156
- }
157
-
158
- confClone := & lint.Config {
159
- MinVersion : defConf .MinVersion ,
160
- Formatter : defConf .Formatter ,
161
- Rules : map [string ]lint.RuleConfig {},
162
- }
163
-
164
- for ruleName , r := range defConf .Rules {
165
- if r .Enabled {
166
- confClone .Rules [ruleName ] = r
167
- }
168
- }
169
- return confClone
152
+ // Default returns default config
153
+ func Default () * lint.Config {
154
+ return defConf
170
155
}
Original file line number Diff line number Diff line change @@ -47,8 +47,8 @@ func hookCreate(confPath string, isReplace bool) error {
47
47
}
48
48
49
49
// configCreate is the callback function for create config command
50
- func configCreate (onlyEnabled , isReplace bool ) error {
51
- defConf := config .GetDefaultConfig ( onlyEnabled )
50
+ func configCreate (isReplace bool ) error {
51
+ defConf := config .Default ( )
52
52
outPath := filepath .Join ("." , config .ConfigFile )
53
53
// if config file already exists skip creating or overwriting it
54
54
if _ , err := os .Stat (outPath ); ! os .IsNotExist (err ) {
Original file line number Diff line number Diff line change @@ -99,12 +99,6 @@ func configCmd() *cli.Command {
99
99
Name : "create" ,
100
100
Usage : "Creates default config in current directory" ,
101
101
Flags : []cli.Flag {
102
- & cli.BoolFlag {
103
- Name : "enabled" ,
104
- Aliases : []string {"e" },
105
- Usage : "writes only default enabled rules" ,
106
- Value : false ,
107
- },
108
102
& cli.BoolFlag {
109
103
Name : "replace" ,
110
104
Aliases : []string {"r" },
@@ -113,9 +107,8 @@ func configCmd() *cli.Command {
113
107
},
114
108
},
115
109
Action : func (ctx * cli.Context ) error {
116
- isOnlyEnabled := ctx .Bool ("enabled" )
117
110
isReplace := ctx .Bool ("replace" )
118
- err := configCreate (isOnlyEnabled , isReplace )
111
+ err := configCreate (isReplace )
119
112
if err != nil {
120
113
if isConfExists (err ) {
121
114
fmt .Println ("config create failed" )
You can’t perform that action at this time.
0 commit comments