Skip to content

Commit 715276d

Browse files
authored
Merge pull request moby#5012 from daghack/lint-cleanup
minor lint formatting cleanups
2 parents 7da4d59 + b4c1b71 commit 715276d

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

frontend/dockerfile/dockerfile2llb/convert.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,10 @@ func toDispatchState(ctx context.Context, dt []byte, opt ConvertOpt) (*dispatchS
276276
// The `dockerfile.Warnings` *should* only contain warnings about empty continuation
277277
// lines, but we'll check the warning message to be sure, so that we don't accidentally
278278
// process warnings that are not related to empty continuation lines twice.
279-
if warning.URL == linter.RuleNoEmptyContinuations.URL {
279+
if warning.URL == linter.RuleNoEmptyContinuation.URL {
280280
location := []parser.Range{*warning.Location}
281-
msg := linter.RuleNoEmptyContinuations.Format()
282-
lint.Run(&linter.RuleNoEmptyContinuations, location, msg)
281+
msg := linter.RuleNoEmptyContinuation.Format()
282+
lint.Run(&linter.RuleNoEmptyContinuation, location, msg)
283283
}
284284
}
285285

frontend/dockerfile/dockerfile_lint_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
var lintTests = integration.TestFuncs(
2626
testRuleCheckOption,
2727
testStageName,
28-
testNoEmptyContinuations,
28+
testNoEmptyContinuation,
2929
testConsistentInstructionCasing,
3030
testFileConsistentCommandCasing,
3131
testDuplicateStageName,
@@ -237,7 +237,7 @@ from scratch as base2
237237
})
238238
}
239239

240-
func testNoEmptyContinuations(t *testing.T, sb integration.Sandbox) {
240+
func testNoEmptyContinuation(t *testing.T, sb integration.Sandbox) {
241241
dockerfile := []byte(`
242242
FROM scratch
243243
# warning: empty continuation line
@@ -252,9 +252,9 @@ COPY Dockerfile \
252252
Dockerfile: dockerfile,
253253
Warnings: []expectedLintWarning{
254254
{
255-
RuleName: "NoEmptyContinuations",
255+
RuleName: "NoEmptyContinuation",
256256
Description: "Empty continuation lines will become errors in a future release",
257-
URL: "https://docs.docker.com/go/dockerfile/rule/no-empty-continuations/",
257+
URL: "https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/",
258258
Detail: "Empty continuation line",
259259
Level: 1,
260260
Line: 6,

frontend/dockerfile/docs/rules/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $ docker build --check .
3737
<td>The 'as' keyword should match the case of the 'from' keyword</td>
3838
</tr>
3939
<tr>
40-
<td><a href="./no-empty-continuations/">NoEmptyContinuations</a></td>
40+
<td><a href="./no-empty-continuation/">NoEmptyContinuation</a></td>
4141
<td>Empty continuation lines will become errors in a future release</td>
4242
</tr>
4343
<tr>

frontend/dockerfile/docs/rules/no-empty-continuations.md renamed to frontend/dockerfile/docs/rules/no-empty-continuation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
2-
title: NoEmptyContinuations
2+
title: NoEmptyContinuation
33
description: Empty continuation lines will become errors in a future release
44
aliases:
5-
- /go/dockerfile/rule/no-empty-continuations/
5+
- /go/dockerfile/rule/no-empty-continuation/
66
---
77

88
## Output
File renamed without changes.

frontend/dockerfile/linter/linter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ func (rule *LinterRule[F]) Run(warn LintWarnFunc, location []parser.Range, txt .
9292
}
9393

9494
func LintFormatShort(rulename, msg string, startLine int) string {
95-
return fmt.Sprintf("Lint Rule '%s': %s (line %d)", rulename, msg, startLine)
95+
return fmt.Sprintf("%s: %s (line %d)", rulename, msg, startLine)
9696
}
9797

9898
type LintWarnFunc func(rulename, description, url, fmtmsg string, location []parser.Range)

frontend/dockerfile/linter/ruleset.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ var (
2121
return fmt.Sprintf("'%s' and '%s' keywords' casing do not match", as, from)
2222
},
2323
}
24-
RuleNoEmptyContinuations = LinterRule[func() string]{
25-
Name: "NoEmptyContinuations",
24+
RuleNoEmptyContinuation = LinterRule[func() string]{
25+
Name: "NoEmptyContinuation",
2626
Description: "Empty continuation lines will become errors in a future release",
27-
URL: "https://docs.docker.com/go/dockerfile/rule/no-empty-continuations/",
27+
URL: "https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/",
2828
Format: func() string {
2929
return "Empty continuation line"
3030
},

frontend/dockerfile/parser/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func Parse(rwc io.Reader) (*Result, error) {
338338
warnings = append(warnings, Warning{
339339
Short: "Empty continuation line found in: " + line,
340340
Detail: [][]byte{[]byte("Empty continuation lines will become errors in a future release")},
341-
URL: "https://docs.docker.com/go/dockerfile/rule/no-empty-continuations/",
341+
URL: "https://docs.docker.com/go/dockerfile/rule/no-empty-continuation/",
342342
Location: &Range{Start: Position{Line: currentLine}, End: Position{Line: currentLine}},
343343
})
344344
}

0 commit comments

Comments
 (0)