@@ -235,7 +235,7 @@ func safeTomlSlice(r []interface{}) []interface{} {
235235}
236236
237237// This element is not exported by revive, so we need copy the code.
238- // Extracted from https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec /config/config.go#L15
238+ // Extracted from https://github.com/mgechev/revive/blob/111721be475b73b5a2304dd01ccbcab587357fca /config/config.go#L15
239239var defaultRules = []lint.Rule {
240240 & rule.VarDeclarationsRule {},
241241 & rule.PackageCommentsRule {},
@@ -257,12 +257,80 @@ var defaultRules = []lint.Rule{
257257 & rule.ContextAsArgumentRule {},
258258}
259259
260+ var allRules = append ([]lint.Rule {
261+ & rule.ArgumentsLimitRule {},
262+ & rule.CyclomaticRule {},
263+ & rule.FileHeaderRule {},
264+ & rule.EmptyBlockRule {},
265+ & rule.SuperfluousElseRule {},
266+ & rule.ConfusingNamingRule {},
267+ & rule.GetReturnRule {},
268+ & rule.ModifiesParamRule {},
269+ & rule.ConfusingResultsRule {},
270+ & rule.DeepExitRule {},
271+ & rule.UnusedParamRule {},
272+ & rule.UnreachableCodeRule {},
273+ & rule.AddConstantRule {},
274+ & rule.FlagParamRule {},
275+ & rule.UnnecessaryStmtRule {},
276+ & rule.StructTagRule {},
277+ & rule.ModifiesValRecRule {},
278+ & rule.ConstantLogicalExprRule {},
279+ & rule.BoolLiteralRule {},
280+ & rule.RedefinesBuiltinIDRule {},
281+ & rule.ImportsBlacklistRule {},
282+ & rule.FunctionResultsLimitRule {},
283+ & rule.MaxPublicStructsRule {},
284+ & rule.RangeValInClosureRule {},
285+ & rule.RangeValAddress {},
286+ & rule.WaitGroupByValueRule {},
287+ & rule.AtomicRule {},
288+ & rule.EmptyLinesRule {},
289+ & rule.LineLengthLimitRule {},
290+ & rule.CallToGCRule {},
291+ & rule.DuplicatedImportsRule {},
292+ & rule.ImportShadowingRule {},
293+ & rule.BareReturnRule {},
294+ & rule.UnusedReceiverRule {},
295+ & rule.UnhandledErrorRule {},
296+ & rule.CognitiveComplexityRule {},
297+ & rule.StringOfIntRule {},
298+ & rule.StringFormatRule {},
299+ & rule.EarlyReturnRule {},
300+ & rule.UnconditionalRecursionRule {},
301+ & rule.IdenticalBranchesRule {},
302+ & rule.DeferRule {},
303+ & rule.UnexportedNamingRule {},
304+ & rule.FunctionLength {},
305+ & rule.NestedStructs {},
306+ & rule.IfReturnRule {},
307+ & rule.UselessBreak {},
308+ }, defaultRules ... )
309+
260310// This element is not exported by revive, so we need copy the code.
261- // Extracted from https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec /config/config.go#L133
311+ // Extracted from https://github.com/mgechev/revive/blob/111721be475b73b5a2304dd01ccbcab587357fca /config/config.go#L143
262312func normalizeConfig (cfg * lint.Config ) {
313+ const defaultConfidence = 0.8
263314 if cfg .Confidence == 0 {
264- cfg .Confidence = 0.8
315+ cfg .Confidence = defaultConfidence
316+ }
317+
318+ if len (cfg .Rules ) == 0 {
319+ cfg .Rules = map [string ]lint.RuleConfig {}
265320 }
321+ if cfg .EnableAllRules {
322+ // Add to the configuration all rules not yet present in it
323+ for _ , rule := range allRules {
324+ ruleName := rule .Name ()
325+ _ , alreadyInConf := cfg .Rules [ruleName ]
326+ if alreadyInConf {
327+ continue
328+ }
329+ // Add the rule with an empty conf for
330+ cfg .Rules [ruleName ] = lint.RuleConfig {}
331+ }
332+ }
333+
266334 severity := cfg .Severity
267335 if severity != "" {
268336 for k , v := range cfg .Rules {
@@ -281,7 +349,7 @@ func normalizeConfig(cfg *lint.Config) {
281349}
282350
283351// This element is not exported by revive, so we need copy the code.
284- // Extracted from https://github.com/mgechev/revive/blob/389ba853b0b3587f0c3b71b5f0c61ea4e23928ec /config/config.go#L182
352+ // Extracted from https://github.com/mgechev/revive/blob/111721be475b73b5a2304dd01ccbcab587357fca /config/config.go#L210
285353func defaultConfig () * lint.Config {
286354 defaultConfig := lint.Config {
287355 Confidence : 0.0 ,
0 commit comments