Skip to content

Commit 51a6dc4

Browse files
committed
Adds a deprecated flag to linter rules
Signed-off-by: Talon Bowler <[email protected]>
1 parent 555979d commit 51a6dc4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

frontend/dockerfile/linter/linter.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func New(config *Config) *Linter {
3939
}
4040

4141
func (lc *Linter) Run(rule LinterRuleI, location []parser.Range, txt ...string) {
42-
if lc == nil || lc.Warn == nil || lc.SkipAll {
42+
if lc == nil || lc.Warn == nil || lc.SkipAll || rule.IsDeprecated() {
4343
return
4444
}
4545
rulename := rule.RuleName()
@@ -71,11 +71,13 @@ func (lc *Linter) Error() error {
7171
type LinterRuleI interface {
7272
RuleName() string
7373
Run(warn LintWarnFunc, location []parser.Range, txt ...string)
74+
IsDeprecated() bool
7475
}
7576

7677
type LinterRule[F any] struct {
7778
Name string
7879
Description string
80+
Deprecated bool
7981
URL string
8082
Format F
8183
}
@@ -92,6 +94,10 @@ func (rule *LinterRule[F]) Run(warn LintWarnFunc, location []parser.Range, txt .
9294
warn(rule.Name, rule.Description, rule.URL, short, location)
9395
}
9496

97+
func (rule *LinterRule[F]) IsDeprecated() bool {
98+
return rule.Deprecated
99+
}
100+
95101
func LintFormatShort(rulename, msg string, line int) string {
96102
msg = fmt.Sprintf("%s: %s", rulename, msg)
97103
if line > 0 {

0 commit comments

Comments
 (0)