Skip to content

Commit aebcc1f

Browse files
authored
Merge pull request moby#4990 from crazy-max/docs-dockerfile-gen
dockerfile: generate lint rules documentation
2 parents 49b935f + 37fc95a commit aebcc1f

38 files changed

+1614
-37
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ doctoc:
113113
docs:
114114
$(BUILDX_CMD) bake docs
115115

116+
.PHONY: docs-dockerfile
117+
docs-dockerfile:
118+
$(BUILDX_CMD) bake docs-dockerfile
119+
116120
.PHONY: mod-outdated
117121
mod-outdated:
118122
$(BUILDX_CMD) bake mod-outdated

docker-bake.hcl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ target "integration-tests" {
126126
}
127127

128128
group "validate" {
129-
targets = ["lint", "validate-vendor", "validate-doctoc", "validate-generated-files", "validate-archutil", "validate-shfmt", "validate-docs"]
129+
targets = ["lint", "validate-vendor", "validate-doctoc", "validate-generated-files", "validate-archutil", "validate-shfmt", "validate-docs", "validate-docs-dockerfile"]
130130
}
131131

132132
target "lint" {
@@ -211,6 +211,13 @@ target "validate-docs" {
211211
output = ["type=cacheonly"]
212212
}
213213

214+
target "validate-docs-dockerfile" {
215+
inherits = ["_common"]
216+
dockerfile = "./hack/dockerfiles/docs-dockerfile.Dockerfile"
217+
target = "validate"
218+
output = ["type=cacheonly"]
219+
}
220+
214221
target "vendor" {
215222
inherits = ["_common"]
216223
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
@@ -260,6 +267,13 @@ target "docs" {
260267
output = ["./docs"]
261268
}
262269

270+
target "docs-dockerfile" {
271+
inherits = ["_common"]
272+
dockerfile = "./hack/dockerfiles/docs-dockerfile.Dockerfile"
273+
target = "update"
274+
output = ["./frontend/dockerfile/docs/rules"]
275+
}
276+
263277
target "mod-outdated" {
264278
inherits = ["_common"]
265279
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"

frontend/dockerfile/dockerfile2llb/convert.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2164,8 +2164,8 @@ func validateCommandCasing(dockerfile *parser.Result, lint *linter.Linter) {
21642164
// as well as ensuring that the casing is consistent throughout the dockerfile by comparing the
21652165
// command to the casing of the majority of commands.
21662166
if !isSelfConsistentCasing(node.Value) {
2167-
msg := linter.RuleSelfConsistentCommandCasing.Format(node.Value)
2168-
lint.Run(&linter.RuleSelfConsistentCommandCasing, node.Location(), msg)
2167+
msg := linter.RuleConsistentInstructionCasing.Format(node.Value)
2168+
lint.Run(&linter.RuleConsistentInstructionCasing, node.Location(), msg)
21692169
} else {
21702170
var msg string
21712171
var needsLintWarn bool
@@ -2284,8 +2284,8 @@ func toPBLocation(sourceIndex int, location []parser.Range) pb.Location {
22842284
func reportUnusedFromArgs(values []string, unmatched map[string]struct{}, location []parser.Range, lint *linter.Linter) {
22852285
for arg := range unmatched {
22862286
suggest, _ := suggest.Search(arg, values, true)
2287-
msg := linter.RuleUndeclaredArgInFrom.Format(arg, suggest)
2288-
lint.Run(&linter.RuleUndeclaredArgInFrom, location, msg)
2287+
msg := linter.RuleUndefinedArgInFrom.Format(arg, suggest)
2288+
lint.Run(&linter.RuleUndefinedArgInFrom, location, msg)
22892289
}
22902290
}
22912291

0 commit comments

Comments
 (0)