fix: hide useless warning (#4587)
Some checks failed
Release a tag / release (push) Has been cancelled

This commit is contained in:
Ludovic Fernandez 2024-03-28 19:39:06 +01:00 committed by GitHub
parent 5a66842555
commit 77a8601aa3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -160,7 +160,11 @@ issues:
linters: [staticcheck]
text: "SA1019: c.cfg.Run.ShowStats is deprecated: use Output.ShowStats instead."
- path: pkg/commands/config.go
linters: [staticcheck]
text: "SA1019: cfg.Run.UseDefaultSkipDirs is deprecated: use Issues.UseDefaultExcludeDirs instead."
- path: pkg/commands/linters.go
linters: [staticcheck]
text: "SA1019: c.cfg.Run.UseDefaultSkipDirs is deprecated: use Issues.UseDefaultExcludeDirs instead."
# Deprecated linter options.
- path: pkg/golinters/errcheck.go

View File

@ -59,6 +59,13 @@ func newLintersCommand(logger logutils.Log) *lintersCommand {
}
func (c *lintersCommand) preRunE(cmd *cobra.Command, _ []string) error {
// Hack to hide deprecation messages related to `--skip-dirs-use-default`:
// Flags are not bound then the default values, defined only through flags, are not applied.
// In this command, linters information are the only requirements, i.e. it don't need flag values.
//
// TODO(ldez) add an option (check deprecation) to `Loader.Load()` but this require a dedicated PR.
c.cfg.Run.UseDefaultSkipDirs = true
loader := config.NewLoader(c.log.Child(logutils.DebugKeyConfigReader), c.viper, cmd.Flags(), c.opts.LoaderOptions, c.cfg)
if err := loader.Load(); err != nil {