Skip to content

Commit

Permalink
Merge pull request #4990 from crazy-max/docs-dockerfile-gen
Browse files Browse the repository at this point in the history
dockerfile: generate lint rules documentation
  • Loading branch information
tonistiigi authored Jun 6, 2024
2 parents 49b935f + 37fc95a commit aebcc1f
Show file tree
Hide file tree
Showing 38 changed files with 1,614 additions and 37 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ doctoc:
docs:
$(BUILDX_CMD) bake docs

.PHONY: docs-dockerfile
docs-dockerfile:
$(BUILDX_CMD) bake docs-dockerfile

.PHONY: mod-outdated
mod-outdated:
$(BUILDX_CMD) bake mod-outdated
16 changes: 15 additions & 1 deletion docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ target "integration-tests" {
}

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

target "lint" {
Expand Down Expand Up @@ -211,6 +211,13 @@ target "validate-docs" {
output = ["type=cacheonly"]
}

target "validate-docs-dockerfile" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/docs-dockerfile.Dockerfile"
target = "validate"
output = ["type=cacheonly"]
}

target "vendor" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
Expand Down Expand Up @@ -260,6 +267,13 @@ target "docs" {
output = ["./docs"]
}

target "docs-dockerfile" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/docs-dockerfile.Dockerfile"
target = "update"
output = ["./frontend/dockerfile/docs/rules"]
}

target "mod-outdated" {
inherits = ["_common"]
dockerfile = "./hack/dockerfiles/vendor.Dockerfile"
Expand Down
8 changes: 4 additions & 4 deletions frontend/dockerfile/dockerfile2llb/convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -2164,8 +2164,8 @@ func validateCommandCasing(dockerfile *parser.Result, lint *linter.Linter) {
// as well as ensuring that the casing is consistent throughout the dockerfile by comparing the
// command to the casing of the majority of commands.
if !isSelfConsistentCasing(node.Value) {
msg := linter.RuleSelfConsistentCommandCasing.Format(node.Value)
lint.Run(&linter.RuleSelfConsistentCommandCasing, node.Location(), msg)
msg := linter.RuleConsistentInstructionCasing.Format(node.Value)
lint.Run(&linter.RuleConsistentInstructionCasing, node.Location(), msg)
} else {
var msg string
var needsLintWarn bool
Expand Down Expand Up @@ -2284,8 +2284,8 @@ func toPBLocation(sourceIndex int, location []parser.Range) pb.Location {
func reportUnusedFromArgs(values []string, unmatched map[string]struct{}, location []parser.Range, lint *linter.Linter) {
for arg := range unmatched {
suggest, _ := suggest.Search(arg, values, true)
msg := linter.RuleUndeclaredArgInFrom.Format(arg, suggest)
lint.Run(&linter.RuleUndeclaredArgInFrom, location, msg)
msg := linter.RuleUndefinedArgInFrom.Format(arg, suggest)
lint.Run(&linter.RuleUndefinedArgInFrom, location, msg)
}
}

Expand Down
Loading

0 comments on commit aebcc1f

Please sign in to comment.