Skip to content

Commit 4dabdd3

Browse files
committed
dev: introduce deprecated functions with reasons
1 parent 2b24c4e commit 4dabdd3

File tree

2 files changed

+27
-15
lines changed

2 files changed

+27
-15
lines changed

pkg/lint/linter/config.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,19 @@ func (lc *Config) DeprecatedWarning(message, version, replacement string) *Confi
136136
return lc.Deprecated(message, version, replacement, DeprecationWarning)
137137
}
138138

139-
func (lc *Config) DeprecatedError(message, version, replacement string) *Config {
139+
func (lc *Config) DeprecatedBecauseAbandoned(version, replacement string) *Config {
140+
return lc.deprecatedError("The owner seems to have abandoned the linter.", version, replacement)
141+
}
142+
143+
func (lc *Config) DeprecatedBecauseArchived(version, replacement string) *Config {
144+
return lc.deprecatedError("The repository of the linter has been archived by the owner.", version, replacement)
145+
}
146+
147+
func (lc *Config) DeprecatedBecauseRenamed(version, replacement string) *Config {
148+
return lc.deprecatedError("The linter has been renamed.", version, replacement)
149+
}
150+
151+
func (lc *Config) deprecatedError(message, version, replacement string) *Config {
140152
return lc.Deprecated(message, version, replacement, DeprecationError)
141153
}
142154

pkg/lint/lintersdb/builder_linter.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
199199
WithSince("v1.0.0").
200200
WithPresets(linter.PresetUnused).
201201
WithURL("https://github.com/remyoudompheng/go-misc/tree/HEAD/deadcode").
202-
DeprecatedError("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
202+
DeprecatedBecauseAbandoned("v1.49.0", "unused"),
203203

204204
linter.NewConfig(depguard.New(&cfg.LintersSettings.Depguard, cfg.GetBasePath())).
205205
WithSince("v1.4.0").
@@ -258,7 +258,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
258258
WithSince("v1.46.0").
259259
WithPresets(linter.PresetSQL).
260260
WithURL("https://github.com/1uf3/execinquery").
261-
DeprecatedError("The repository of the linter has been archived by the owner.", "v1.58.0", ""),
261+
DeprecatedBecauseArchived("v1.58.0", ""),
262262

263263
linter.NewConfig(exhaustive.New(&cfg.LintersSettings.Exhaustive)).
264264
WithSince(" v1.28.0").
@@ -270,7 +270,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
270270
WithSince("v1.32.0").
271271
WithPresets(linter.PresetStyle, linter.PresetTest).
272272
WithURL("https://github.com/mbilski/exhaustivestruct").
273-
DeprecatedError("The repository of the linter has been deprecated by the owner.", "v1.46.0", "exhaustruct"),
273+
DeprecatedBecauseArchived("v1.46.0", "exhaustruct"),
274274

275275
linter.NewConfig(exhaustruct.New(&cfg.LintersSettings.Exhaustruct)).
276276
WithSince("v1.46.0").
@@ -283,7 +283,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
283283
WithPresets(linter.PresetBugs).
284284
WithLoadForGoAnalysis().
285285
WithURL("https://github.com/kyoh86/exportloopref").
286-
DeprecatedWarning("Since Go1.22 (loopvar) this linter is no longer relevant.", "v1.60.2", "copyloopvar"),
286+
DeprecatedWarning("Since Go 1.22 (loopvar) this linter is no longer relevant.", "v1.60.2", "copyloopvar"),
287287

288288
linter.NewConfig(exptostd.New()).
289289
WithSince("v1.63.0").
@@ -422,7 +422,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
422422
WithSince("v1.0.0").
423423
WithPresets(linter.PresetStyle).
424424
WithURL("https://github.com/golang/lint").
425-
DeprecatedError("The repository of the linter has been archived by the owner.", "v1.41.0", "revive"),
425+
DeprecatedBecauseArchived("v1.41.0", "revive"),
426426

427427
linter.NewConfig(mnd.New(&cfg.LintersSettings.Mnd)).
428428
WithSince("v1.22.0").
@@ -433,7 +433,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
433433
WithSince("v1.22.0").
434434
WithPresets(linter.PresetStyle).
435435
WithURL("https://github.com/tommy-muehle/go-mnd").
436-
DeprecatedError("The linter has been renamed.", "v1.58.0", "mnd"),
436+
DeprecatedBecauseRenamed("v1.58.0", "mnd"),
437437

438438
linter.NewConfig(gomoddirectives.New(&cfg.LintersSettings.GoModDirectives)).
439439
WithSince("v1.39.0").
@@ -490,7 +490,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
490490
WithSince("v1.36.0").
491491
WithPresets(linter.PresetStyle).
492492
WithURL("https://github.com/esimonov/ifshort").
493-
DeprecatedError("The repository of the linter has been deprecated by the owner.", "v1.48.0", ""),
493+
DeprecatedBecauseArchived("v1.48.0", ""),
494494

495495
linter.NewConfig(iface.New(&cfg.LintersSettings.Iface)).
496496
WithSince("v1.62.0").
@@ -526,7 +526,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
526526
WithSince("v1.0.0").
527527
WithPresets(linter.PresetStyle).
528528
WithURL("https://github.com/mvdan/interfacer").
529-
DeprecatedError("The repository of the linter has been archived by the owner.", "v1.38.0", ""),
529+
DeprecatedBecauseArchived("v1.38.0", ""),
530530

531531
linter.NewConfig(intrange.New()).
532532
WithSince("v1.57.0").
@@ -568,7 +568,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
568568
WithSince("v1.0.0").
569569
WithPresets(linter.PresetPerformance).
570570
WithURL("https://github.com/mdempsky/maligned").
571-
DeprecatedError("The repository of the linter has been archived by the owner.", "v1.38.0", "govet 'fieldalignment'"),
571+
DeprecatedBecauseArchived("v1.38.0", "govet 'fieldalignment'"),
572572

573573
linter.NewConfig(mirror.New()).
574574
WithSince("v1.53.0").
@@ -640,7 +640,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
640640
WithSince("v1.47.0").
641641
WithPresets(linter.PresetStyle).
642642
WithURL("https://github.com/sivchari/nosnakecase").
643-
DeprecatedError("The repository of the linter has been deprecated by the owner.", "v1.48.1", "revive 'var-naming'"),
643+
DeprecatedBecauseArchived("v1.48.1", "revive 'var-naming'"),
644644

645645
linter.NewConfig(nosprintfhostport.New()).
646646
WithSince("v1.46.0").
@@ -717,7 +717,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
717717
WithSince("v1.12.0").
718718
WithPresets(linter.PresetBugs).
719719
WithURL("https://github.com/kyoh86/scopelint").
720-
DeprecatedError("The repository of the linter has been deprecated by the owner.", "v1.39.0", "exportloopref"),
720+
DeprecatedBecauseArchived("v1.39.0", "exportloopref"),
721721

722722
linter.NewConfig(sqlclosecheck.New()).
723723
WithSince("v1.28.0").
@@ -744,7 +744,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
744744
WithSince("v1.0.0").
745745
WithPresets(linter.PresetUnused).
746746
WithURL("https://github.com/opennota/check").
747-
DeprecatedError("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
747+
DeprecatedBecauseAbandoned("v1.49.0", "unused"),
748748

749749
linter.NewConfig(stylecheck.New(&cfg.LintersSettings.Stylecheck)).
750750
WithSince("v1.20.0").
@@ -770,7 +770,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
770770
WithPresets(linter.PresetTest).
771771
WithLoadForGoAnalysis().
772772
WithURL("https://github.com/sivchari/tenv").
773-
DeprecatedWarning("Duplicate feature another linter.", "v1.64.0", "usetesting"),
773+
DeprecatedWarning("Duplicate feature in another linter.", "v1.64.0", "usetesting"),
774774

775775
linter.NewConfig(testableexamples.New()).
776776
WithSince("v1.50.0").
@@ -845,7 +845,7 @@ func (LinterBuilder) Build(cfg *config.Config) ([]*linter.Config, error) {
845845
WithSince("v1.0.0").
846846
WithPresets(linter.PresetUnused).
847847
WithURL("https://github.com/opennota/check").
848-
DeprecatedError("The owner seems to have abandoned the linter.", "v1.49.0", "unused"),
848+
DeprecatedBecauseAbandoned("v1.49.0", "unused"),
849849

850850
linter.NewConfig(varnamelen.New(&cfg.LintersSettings.Varnamelen)).
851851
WithSince("v1.43.0").

0 commit comments

Comments
 (0)