@@ -169,8 +169,8 @@ func (w *wrapper) toIssue(pass *analysis.Pass, failure *lint.Failure) *goanalysi
169169// This function mimics the GetConfig function of revive.
170170// This allows to get default values and right types.
171171// https://github.com/golangci/golangci-lint/issues/1745
172- // https://github.com/mgechev/revive/blob/v1.6 .0/config/config.go#L230
173- // https://github.com/mgechev/revive/blob/v1.6 .0/config/config.go#L182-L188
172+ // https://github.com/mgechev/revive/blob/v1.13 .0/config/config.go#L249
173+ // https://github.com/mgechev/revive/blob/v1.13 .0/config/config.go#L198-L204
174174func getConfig (cfg * config.ReviveSettings ) (* lint.Config , error ) {
175175 conf := defaultConfig ()
176176
@@ -269,7 +269,7 @@ func safeTomlSlice(r []any) []any {
269269}
270270
271271// This element is not exported by revive, so we need copy the code.
272- // Extracted from https://github.com/mgechev/revive/blob/v1.12 .0/config/config.go#L16
272+ // Extracted from https://github.com/mgechev/revive/blob/v1.13 .0/config/config.go#L16
273273var defaultRules = []lint.Rule {
274274 & rule.VarDeclarationsRule {},
275275 & rule.PackageCommentsRule {},
@@ -325,6 +325,7 @@ var allRules = append([]lint.Rule{
325325 & rule.FileLengthLimitRule {},
326326 & rule.FilenameFormatRule {},
327327 & rule.FlagParamRule {},
328+ & rule.ForbiddenCallInWgGoRule {},
328329 & rule.FunctionLength {},
329330 & rule.FunctionResultsLimitRule {},
330331 & rule.GetReturnRule {},
@@ -337,6 +338,7 @@ var allRules = append([]lint.Rule{
337338 & rule.ImportAliasNamingRule {},
338339 & rule.ImportsBlocklistRule {},
339340 & rule.ImportShadowingRule {},
341+ & rule.InefficientMapLookupRule {},
340342 & rule.LineLengthLimitRule {},
341343 & rule.MaxControlNestingRule {},
342344 & rule.MaxPublicStructsRule {},
@@ -360,6 +362,7 @@ var allRules = append([]lint.Rule{
360362 & rule.UnexportedNamingRule {},
361363 & rule.UnhandledErrorRule {},
362364 & rule.UnnecessaryFormatRule {},
365+ & rule.UnnecessaryIfRule {},
363366 & rule.UnnecessaryStmtRule {},
364367 & rule.UnsecureURLSchemeRule {},
365368 & rule.UnusedReceiverRule {},
@@ -375,7 +378,7 @@ var allRules = append([]lint.Rule{
375378const defaultConfidence = 0.8
376379
377380// This element is not exported by revive, so we need copy the code.
378- // Extracted from https://github.com/mgechev/revive/blob/v1.12 .0/config/config.go#L206
381+ // Extracted from https://github.com/mgechev/revive/blob/v1.13 .0/config/config.go#L209
379382func normalizeConfig (cfg * lint.Config ) {
380383 // NOTE(ldez): this custom section for golangci-lint should be kept.
381384 // ---
@@ -386,19 +389,22 @@ func normalizeConfig(cfg *lint.Config) {
386389 if len (cfg .Rules ) == 0 {
387390 cfg .Rules = map [string ]lint.RuleConfig {}
388391 }
389- if cfg . EnableAllRules {
390- // Add to the configuration all rules not yet present in it
391- for _ , r := range allRules {
392+
393+ addRules := func ( config * lint. Config , rules []lint. Rule ) {
394+ for _ , r := range rules {
392395 ruleName := r .Name ()
393- _ , alreadyInConf := cfg .Rules [ruleName ]
394- if alreadyInConf {
395- continue
396+ if _ , ok := config .Rules [ruleName ]; ! ok {
397+ config .Rules [ruleName ] = lint.RuleConfig {}
396398 }
397- // Add the rule with an empty conf for
398- cfg .Rules [ruleName ] = lint.RuleConfig {}
399399 }
400400 }
401401
402+ if cfg .EnableAllRules {
403+ addRules (cfg , allRules )
404+ } else if cfg .EnableDefaultRules {
405+ addRules (cfg , defaultRules )
406+ }
407+
402408 severity := cfg .Severity
403409 if severity != "" {
404410 for k , v := range cfg .Rules {
@@ -417,7 +423,7 @@ func normalizeConfig(cfg *lint.Config) {
417423}
418424
419425// This element is not exported by revive, so we need copy the code.
420- // Extracted from https://github.com/mgechev/revive/blob/v1.12 .0/config/config.go#L274
426+ // Extracted from https://github.com/mgechev/revive/blob/v1.13 .0/config/config.go#L280
421427func defaultConfig () * lint.Config {
422428 defaultConfig := lint.Config {
423429 Confidence : defaultConfidence ,
@@ -463,7 +469,7 @@ func extractRulesName(rules []lint.Rule) []string {
463469 return names
464470}
465471
466- // Extracted from https://github.com/mgechev/revive/blob/v1.12 .0/formatter/severity.go
472+ // Extracted from https://github.com/mgechev/revive/blob/v1.13 .0/formatter/severity.go
467473// Modified to use pointers (related to hugeParam rule).
468474func severity (cfg * lint.Config , failure * lint.Failure ) lint.Severity {
469475 if cfg , ok := cfg .Rules [failure .RuleName ]; ok && cfg .Severity == lint .SeverityError {
0 commit comments