Skip to content

feat: deprecation step 2 of execinquery and gomnd #5110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ require (
github.com/ldez/gomoddirectives v0.2.4
github.com/ldez/tagliatelle v0.5.0
github.com/leonklingele/grouper v1.1.2
github.com/lufeee/execinquery v1.2.1
github.com/macabu/inamedparam v0.1.3
github.com/maratori/testableexamples v1.0.0
github.com/maratori/testpackage v1.1.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@
"contextcheck",
"copyloopvar",
"cyclop",
"deadcode",
"decorder",
"depguard",
"dogsled",
Expand All @@ -328,9 +327,7 @@
"errchkjson",
"errname",
"errorlint",
"execinquery",
"exhaustive",
"exhaustivestruct",
"exhaustruct",
"exportloopref",
"fatcontext",
Expand All @@ -354,7 +351,6 @@
"gofumpt",
"goheader",
"goimports",
"golint",
"gomoddirectives",
"gomodguard",
"goprintffuncname",
Expand All @@ -364,19 +360,16 @@
"govet",
"grouper",
"iface",
"ifshort",
"importas",
"inamedparam",
"ineffassign",
"interfacebloat",
"interfacer",
"intrange",
"ireturn",
"lll",
"loggercheck",
"maintidx",
"makezero",
"maligned",
"mirror",
"misspell",
"mnd",
Expand All @@ -389,7 +382,6 @@
"noctx",
"nolintlint",
"nonamedreturns",
"nosnakecase",
"nosprintfhostport",
"paralleltest",
"perfsprint",
Expand All @@ -401,11 +393,9 @@
"recvcheck",
"revive",
"rowserrcheck",
"scopelint",
"sloglint",
"sqlclosecheck",
"staticcheck",
"structcheck",
"stylecheck",
"tagalign",
"tagliatelle",
Expand All @@ -419,7 +409,6 @@
"unparam",
"unused",
"usestdlibvars",
"varcheck",
"varnamelen",
"wastedassign",
"whitespace",
Expand Down
9 changes: 0 additions & 9 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ type LintersSettings struct {
Gofumpt GofumptSettings
Goheader GoHeaderSettings
Goimports GoImportsSettings
Gomnd GoMndSettings
GoModDirectives GoModDirectivesSettings
Gomodguard GoModGuardSettings
Gosec GoSecSettings
Expand Down Expand Up @@ -569,14 +568,6 @@ type GoImportsSettings struct {
LocalPrefixes string `mapstructure:"local-prefixes"`
}

// Deprecated: use MndSettings.
type GoMndSettings struct {
MndSettings `mapstructure:",squash"`

// Deprecated: use root level settings instead.
Settings map[string]map[string]any
}

type GoModDirectivesSettings struct {
ReplaceAllowList []string `mapstructure:"replace-allow-list"`
ReplaceLocal bool `mapstructure:"replace-local"`
Expand Down
6 changes: 0 additions & 6 deletions pkg/config/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,6 @@ func (l *Loader) handleLinterOptionDeprecations() {
l.log.Warnf("The configuration option `linters.godot.check-all` is deprecated, please use `linters.godot.scope: all`.")
}

// Deprecated since v1.44.0.
if len(l.cfg.LintersSettings.Gomnd.Settings) > 0 {
l.log.Warnf("The configuration option `linters.gomnd.settings` is deprecated. Please use the options " +
"`linters.gomnd.checks`,`linters.gomnd.ignored-numbers`,`linters.gomnd.ignored-files`,`linters.gomnd.ignored-functions`.")
}

// Deprecated since v1.47.0
if l.cfg.LintersSettings.Gofumpt.LangVersion != "" {
l.log.Warnf("The configuration option `linters.gofumpt.lang-version` is deprecated, please use global `run.go`.")
Expand Down
19 changes: 0 additions & 19 deletions pkg/golinters/execinquery/execinquery.go

This file was deleted.

11 changes: 0 additions & 11 deletions pkg/golinters/execinquery/execinquery_integration_test.go

This file was deleted.

30 changes: 0 additions & 30 deletions pkg/golinters/execinquery/testdata/execinquery.go

This file was deleted.

21 changes: 0 additions & 21 deletions pkg/golinters/mnd/mnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,6 @@ func New(settings *config.MndSettings) *goanalysis.Linter {
return newMND(mnd.Analyzer, settings, nil)
}

func NewGoMND(settings *config.GoMndSettings) *goanalysis.Linter {
// shallow copy because mnd.Analyzer is a global variable.
a := new(analysis.Analyzer)
*a = *mnd.Analyzer

// Used to force the analyzer name to use the same name as the linter.
// This is required to avoid displaying the analyzer name inside the issue text.
a.Name = "gomnd"

var linterCfg map[string]map[string]any

if settings != nil && len(settings.Settings) > 0 {
// Convert deprecated setting.
linterCfg = map[string]map[string]any{
a.Name: settings.Settings["mnd"],
}
}

return newMND(a, &settings.MndSettings, linterCfg)
}

func newMND(a *analysis.Analyzer, settings *config.MndSettings, linterCfg map[string]map[string]any) *goanalysis.Linter {
if len(linterCfg) == 0 && settings != nil {
cfg := make(map[string]any)
Expand Down
9 changes: 4 additions & 5 deletions pkg/lint/lintersdb/builder_linter.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/golangci/golangci-lint/pkg/golinters/errchkjson"
"github.com/golangci/golangci-lint/pkg/golinters/errname"
"github.com/golangci/golangci-lint/pkg/golinters/errorlint"
"github.com/golangci/golangci-lint/pkg/golinters/execinquery"
"github.com/golangci/golangci-lint/pkg/golinters/exhaustive"
"github.com/golangci/golangci-lint/pkg/golinters/exhaustruct"
"github.com/golangci/golangci-lint/pkg/golinters/exportloopref"
Expand Down Expand Up @@ -250,12 +249,12 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
WithLoadForGoAnalysis().
WithURL("https://github.com/polyfloyd/go-errorlint"),

linter.NewConfig(execinquery.New()).
linter.NewConfig(linter.NewNoopDeprecated("execinquery", cfg, linter.DeprecationError)).
WithSince("v1.46.0").
WithPresets(linter.PresetSQL).
WithLoadForGoAnalysis().
WithURL("https://github.com/1uf3/execinquery").
DeprecatedWarning("The repository of the linter has been archived by the owner.", "v1.58.0", ""),
DeprecatedError("The repository of the linter has been archived by the owner.", "v1.58.0", ""),

linter.NewConfig(exhaustive.New(&cfg.LintersSettings.Exhaustive)).
WithSince(" v1.28.0").
Expand Down Expand Up @@ -418,11 +417,11 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
WithPresets(linter.PresetStyle).
WithURL("https://github.com/tommy-muehle/go-mnd"),

linter.NewConfig(mnd.NewGoMND(&cfg.LintersSettings.Gomnd)).
linter.NewConfig(linter.NewNoopDeprecated("gomnd", cfg, linter.DeprecationError)).
WithSince("v1.22.0").
WithPresets(linter.PresetStyle).
WithURL("https://github.com/tommy-muehle/go-mnd").
DeprecatedWarning("The linter has been renamed.", "v1.58.0", "mnd"),
DeprecatedError("The linter has been renamed.", "v1.58.0", "mnd"),

linter.NewConfig(gomoddirectives.New(&cfg.LintersSettings.GoModDirectives)).
WithSince("v1.39.0").
Expand Down
Loading