Skip to content

Commit

Permalink
fix integration tests for new dockerfile empty continuation warning o…
Browse files Browse the repository at this point in the history
…utput

Signed-off-by: Talon Bowler <talon.bowler@docker.com>
  • Loading branch information
daghack committed Mar 18, 2024
1 parent 9ea54fa commit e0ad98b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
17 changes: 1 addition & 16 deletions frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,6 @@ func Dockefile2Outline(ctx context.Context, dt []byte, opt ConvertOpt) (*outline
return &o, nil
}

func lintSourceInfo(srcMap *llb.SourceMap, srcRange *parser.Range) (filename string, source []string) {
if srcMap == nil {
return
}
filename = srcMap.Filename
if srcRange == nil {
return
}
lines := strings.Split(string(srcMap.Data), "\n")
start := srcRange.Start.Line
end := srcRange.End.Line
source = lines[start-1 : end]
return
}

func ListTargets(ctx context.Context, dt []byte) (*targets.List, error) {
dockerfile, err := parser.Parse(bytes.NewReader(dt))
if err != nil {
Expand Down Expand Up @@ -220,7 +205,7 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS
// lines, but we'll check the warning message to be sure.
if warning.URL == linter.RuleNoEmptyContinuations.URL {
location := []parser.Range{*warning.Location}
lintWarn(linter.RuleNoEmptyContinuations, "Empty Continuation Line", location)
lintWarn(linter.RuleNoEmptyContinuations, "Empty continuation line", location)
}
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/dockerfile/dockerfile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6831,7 +6831,7 @@ COPY Dockerfile \

w := warnings[0]

require.Equal(t, "Empty continuation line found in: COPY Dockerfile .", string(w.Short))
require.Equal(t, "Empty continuation line (Dockerfile:5)", string(w.Short))
require.Equal(t, 1, len(w.Detail))
require.Equal(t, "Empty continuation lines will become errors in a future release", string(w.Detail[0]))
require.Equal(t, "https://github.com/moby/moby/pull/33719", w.URL)
Expand Down
6 changes: 3 additions & 3 deletions frontend/dockerfile/linter/ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
)

var (
RuleStageNameCasing LinterRule = LinterRule{
RuleStageNameCasing = LinterRule{
Name: "StageNameCasing",
Description: "Stage names should be lowercase",
}
RuleNoEmptyContinuations LinterRule = LinterRule{
RuleNoEmptyContinuations = LinterRule{
Name: "NoEmptyContinuations",
Description: "Empty continuation lines will become errors in a future release",
URL: "https://github.com/moby/moby/pull/33719",
}
RuleCommandCasing LinterRule = LinterRule{
RuleCommandCasing = LinterRule{
Name: "CommandCasing",
Description: "Commands should be in consistent casing (all lower or all upper)",
}
Expand Down

0 comments on commit e0ad98b

Please sign in to comment.