@@ -304,7 +304,6 @@ func (l *Loader) handleGoVersion() {
304
304
os .Setenv ("GOSECGOVERSION" , l .cfg .Run .Go )
305
305
}
306
306
307
- //nolint:gocyclo // The complexity is expected by the cases to handle.
308
307
func (l * Loader ) handleDeprecation () error {
309
308
if l .cfg .InternalTest || l .cfg .InternalCmdTest || os .Getenv (logutils .EnvTestRun ) == "1" {
310
309
return nil
@@ -322,19 +321,17 @@ func (l *Loader) handleDeprecation() error {
322
321
l .cfg .Issues .ExcludeDirs = l .cfg .Run .SkipDirs
323
322
}
324
323
325
- // The 2 options are true by default.
326
324
// Deprecated since v1.57.0
327
- if ! l .cfg .Run .UseDefaultSkipDirs {
325
+ if l .cfg .Run .UseDefaultSkipDirs != nil {
328
326
l .log .Warnf ("The configuration option `run.skip-dirs-use-default` is deprecated, please use `issues.exclude-dirs-use-default`." )
327
+ l .cfg .Issues .UseDefaultExcludeDirs = * l .cfg .Run .UseDefaultSkipDirs
329
328
}
330
- l .cfg .Issues .UseDefaultExcludeDirs = l .cfg .Run .UseDefaultSkipDirs && l .cfg .Issues .UseDefaultExcludeDirs
331
329
332
- // The 2 options are false by default.
333
330
// Deprecated since v1.57.0
334
- if l .cfg .Run .ShowStats {
331
+ if l .cfg .Run .ShowStats != nil {
335
332
l .log .Warnf ("The configuration option `run.show-stats` is deprecated, please use `output.show-stats`" )
333
+ l .cfg .Output .ShowStats = * l .cfg .Run .ShowStats
336
334
}
337
- l .cfg .Output .ShowStats = l .cfg .Run .ShowStats || l .cfg .Output .ShowStats
338
335
339
336
// Deprecated since v1.63.0
340
337
if l .cfg .Output .UniqByLine != nil {
@@ -363,9 +360,11 @@ func (l *Loader) handleDeprecation() error {
363
360
}
364
361
365
362
// Deprecated since v1.59.0
366
- if l .cfg .Issues .ExcludeGeneratedStrict {
363
+ if l .cfg .Issues .ExcludeGeneratedStrict != nil {
367
364
l .log .Warnf ("The configuration option `issues.exclude-generated-strict` is deprecated, please use `issues.exclude-generated`" )
368
- l .cfg .Issues .ExcludeGenerated = "strict" // Don't use the constants to avoid cyclic dependencies.
365
+ if ! * l .cfg .Issues .ExcludeGeneratedStrict {
366
+ l .cfg .Issues .ExcludeGenerated = "strict" // Don't use the constants to avoid cyclic dependencies.
367
+ }
369
368
}
370
369
371
370
l .handleLinterOptionDeprecations ()
@@ -376,12 +375,12 @@ func (l *Loader) handleDeprecation() error {
376
375
func (l * Loader ) handleLinterOptionDeprecations () {
377
376
// Deprecated since v1.57.0,
378
377
// but it was unofficially deprecated since v1.19 (2019) (https://github.com/golangci/golangci-lint/pull/697).
379
- if l .cfg .LintersSettings .Govet .CheckShadowing {
378
+ if l .cfg .LintersSettings .Govet .CheckShadowing != nil {
380
379
l .log .Warnf ("The configuration option `linters.govet.check-shadowing` is deprecated. " +
381
380
"Please enable `shadow` instead, if you are not using `enable-all`." )
382
381
}
383
382
384
- if l .cfg .LintersSettings .CopyLoopVar .IgnoreAlias {
383
+ if l .cfg .LintersSettings .CopyLoopVar .IgnoreAlias != nil {
385
384
l .log .Warnf ("The configuration option `linters.copyloopvar.ignore-alias` is deprecated and ignored," +
386
385
"please use `linters.copyloopvar.check-alias`." )
387
386
}
@@ -403,7 +402,7 @@ func (l *Loader) handleLinterOptionDeprecations() {
403
402
}
404
403
405
404
// Deprecated since v1.33.0.
406
- if l .cfg .LintersSettings .Godot .CheckAll {
405
+ if l .cfg .LintersSettings .Godot .CheckAll != nil {
407
406
l .log .Warnf ("The configuration option `linters.godot.check-all` is deprecated, please use `linters.godot.scope: all`." )
408
407
}
409
408
@@ -428,23 +427,23 @@ func (l *Loader) handleLinterOptionDeprecations() {
428
427
}
429
428
430
429
// Deprecated since v1.60.0
431
- if ! l .cfg .LintersSettings .Unused .ExportedIsUsed {
430
+ if l .cfg .LintersSettings .Unused .ExportedIsUsed != nil {
432
431
l .log .Warnf ("The configuration option `linters.unused.exported-is-used` is deprecated." )
433
432
}
434
433
435
434
// Deprecated since v1.58.0
436
- if l .cfg .LintersSettings .SlogLint .ContextOnly {
435
+ if l .cfg .LintersSettings .SlogLint .ContextOnly != nil {
437
436
l .log .Warnf ("The configuration option `linters.sloglint.context-only` is deprecated, please use `linters.sloglint.context`." )
438
437
l .cfg .LintersSettings .SlogLint .Context = cmp .Or (l .cfg .LintersSettings .SlogLint .Context , "all" )
439
438
}
440
439
441
440
// Deprecated since v1.51.0
442
- if l .cfg .LintersSettings .UseStdlibVars .OSDevNull {
441
+ if l .cfg .LintersSettings .UseStdlibVars .OSDevNull != nil {
443
442
l .log .Warnf ("The configuration option `linters.usestdlibvars.os-dev-null` is deprecated." )
444
443
}
445
444
446
445
// Deprecated since v1.51.0
447
- if l .cfg .LintersSettings .UseStdlibVars .SyslogPriority {
446
+ if l .cfg .LintersSettings .UseStdlibVars .SyslogPriority != nil {
448
447
l .log .Warnf ("The configuration option `linters.usestdlibvars.syslog-priority` is deprecated." )
449
448
}
450
449
}
0 commit comments