Skip to content

Commit

Permalink
update parse methods to pass linter instead of lintwarnfunc
Browse files Browse the repository at this point in the history
Signed-off-by: Talon Bowler <talon.bowler@docker.com>
  • Loading branch information
daghack committed May 30, 2024
1 parent 80e988e commit 4216f7c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions frontend/dockerfile/instructions/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ func ParseInstructionWithLinter(node *parser.Node, lint *linter.Linter) (v inter
req := newParseRequestFromNode(node)
switch strings.ToLower(node.Value) {
case command.Env:
return parseEnv(req, lintWarn)
return parseEnv(req, lint)
case command.Maintainer:
if lint != nil {
msg := linter.RuleMaintainerDeprecated.Format()
lint.Run(&linter.RuleMaintainerDeprecated, node.Location(), msg)
}
return parseMaintainer(req)
case command.Label:
return parseLabel(req, lintWarn)
return parseLabel(req, lint)
case command.Add:
return parseAdd(req)
case command.Copy:
Expand Down Expand Up @@ -195,7 +195,7 @@ func Parse(ast *parser.Node, lint *linter.Linter) (stages []Stage, metaArgs []Ar
return stages, metaArgs, nil
}

func parseKvps(args []string, cmdName string, location []parser.Range, lint linter.LintWarnFunc) (KeyValuePairs, error) {
func parseKvps(args []string, cmdName string, location []parser.Range, lint *linter.Linter) (KeyValuePairs, error) {
if len(args) == 0 {
return nil, errAtLeastOneArgument(cmdName)
}
Expand All @@ -211,14 +211,14 @@ func parseKvps(args []string, cmdName string, location []parser.Range, lint lint
name, value, sep := args[j], args[j+1], args[j+2]
if sep == "" {
msg := linter.RuleLegacyKeyValueFormat.Format(cmdName)
linter.RuleLegacyKeyValueFormat.Run(lint, location, msg)
lint.Run(&linter.RuleLegacyKeyValueFormat, location, msg)
}
res = append(res, KeyValuePair{Key: name, Value: value})
}
return res, nil
}

func parseEnv(req parseRequest, lint linter.LintWarnFunc) (*EnvCommand, error) {
func parseEnv(req parseRequest, lint *linter.Linter) (*EnvCommand, error) {
if err := req.flags.Parse(); err != nil {
return nil, err
}
Expand Down Expand Up @@ -246,7 +246,7 @@ func parseMaintainer(req parseRequest) (*MaintainerCommand, error) {
}, nil
}

func parseLabel(req parseRequest, lint linter.LintWarnFunc) (*LabelCommand, error) {
func parseLabel(req parseRequest, lint *linter.Linter) (*LabelCommand, error) {
if err := req.flags.Parse(); err != nil {
return nil, err
}
Expand Down

0 comments on commit 4216f7c

Please sign in to comment.