diff --git a/frontend/dockerfile/dockerfile_lint_test.go b/frontend/dockerfile/dockerfile_lint_test.go index be42a14394f9..c2b998dd65e6 100644 --- a/frontend/dockerfile/dockerfile_lint_test.go +++ b/frontend/dockerfile/dockerfile_lint_test.go @@ -312,7 +312,7 @@ COPY $bar . RuleName: "UndefinedVar", Description: "Variables should be defined before their use", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-var/", - Detail: "Usage of undefined variable '$bar'", + Detail: "Usage of undefined variable $bar", Level: 1, Line: 6, }, @@ -322,7 +322,7 @@ COPY $bar . RuleName: "UndefinedVar", Description: "Variables should be defined before their use", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-var/", - Detail: "Usage of undefined variable '$foo'", + Detail: "Usage of undefined variable $foo", Level: 1, Line: 3, }, @@ -330,7 +330,7 @@ COPY $bar . RuleName: "UndefinedVar", Description: "Variables should be defined before their use", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-var/", - Detail: "Usage of undefined variable '$bar'", + Detail: "Usage of undefined variable $bar", Level: 1, Line: 6, }, @@ -374,7 +374,7 @@ copy Dockerfile . RuleName: "FromAsCasing", Description: "The 'as' keyword should match the case of the 'from' keyword", URL: "https://docs.docker.com/go/dockerfile/rule/from-as-casing/", - Detail: "'as' and 'FROM' keywords' casing do not match", + Detail: "'as' and 'FROM' keywords' casing does not match", Line: 2, Level: 1, }, @@ -392,7 +392,7 @@ copy Dockerfile . RuleName: "FromAsCasing", Description: "The 'as' keyword should match the case of the 'from' keyword", URL: "https://docs.docker.com/go/dockerfile/rule/from-as-casing/", - Detail: "'as' and 'FROM' keywords' casing do not match", + Detail: "'as' and 'FROM' keywords' casing does not match", Line: 2, Level: 1, }, @@ -413,7 +413,7 @@ copy Dockerfile . RuleName: "FromAsCasing", Description: "The 'as' keyword should match the case of the 'from' keyword", URL: "https://docs.docker.com/go/dockerfile/rule/from-as-casing/", - Detail: "'as' and 'FROM' keywords' casing do not match", + Detail: "'as' and 'FROM' keywords' casing does not match", Line: 2, Level: 1, }, @@ -465,7 +465,7 @@ FROM scratch AS base3 RuleName: "FromAsCasing", Description: "The 'as' keyword should match the case of the 'from' keyword", URL: "https://docs.docker.com/go/dockerfile/rule/from-as-casing/", - Detail: "'as' and 'FROM' keywords' casing do not match", + Detail: "'as' and 'FROM' keywords' casing does not match", Line: 8, Level: 1, }, @@ -487,7 +487,7 @@ from scratch as base2 RuleName: "FromAsCasing", Description: "The 'as' keyword should match the case of the 'from' keyword", URL: "https://docs.docker.com/go/dockerfile/rule/from-as-casing/", - Detail: "'AS' and 'from' keywords' casing do not match", + Detail: "'AS' and 'from' keywords' casing does not match", Line: 4, Level: 1, }, @@ -535,7 +535,7 @@ FROM scratch AS base2 RuleName: "ConsistentInstructionCasing", Description: "All commands within the Dockerfile should use the same casing (either upper or lower)", URL: "https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/", - Detail: "Command 'From' should match the case of the command majority (uppercase)", + Detail: "Command 'From' should match the case of the majority of commands (uppercase)", Level: 1, Line: 4, }, @@ -556,7 +556,7 @@ COPY Dockerfile /bar RuleName: "ConsistentInstructionCasing", Description: "All commands within the Dockerfile should use the same casing (either upper or lower)", URL: "https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/", - Detail: "Command 'copy' should match the case of the command majority (uppercase)", + Detail: "Command 'copy' should match the case of the majority of commands (uppercase)", Line: 4, Level: 1, }, @@ -576,7 +576,7 @@ from scratch as base2 RuleName: "ConsistentInstructionCasing", Description: "All commands within the Dockerfile should use the same casing (either upper or lower)", URL: "https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/", - Detail: "Command 'frOM' should match the case of the command majority (lowercase)", + Detail: "Command 'frOM' should match the case of the majority of commands (lowercase)", Line: 4, Level: 1, }, @@ -596,7 +596,7 @@ copy Dockerfile /bar RuleName: "ConsistentInstructionCasing", Description: "All commands within the Dockerfile should use the same casing (either upper or lower)", URL: "https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/", - Detail: "Command 'COPY' should match the case of the command majority (lowercase)", + Detail: "Command 'COPY' should match the case of the majority of commands (lowercase)", Line: 4, Level: 1, }, @@ -618,7 +618,7 @@ COPY Dockerfile /baz RuleName: "ConsistentInstructionCasing", Description: "All commands within the Dockerfile should use the same casing (either upper or lower)", URL: "https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/", - Detail: "Command 'from' should match the case of the command majority (uppercase)", + Detail: "Command 'from' should match the case of the majority of commands (uppercase)", Line: 4, Level: 1, }, @@ -640,7 +640,7 @@ copy Dockerfile /baz RuleName: "ConsistentInstructionCasing", Description: "All commands within the Dockerfile should use the same casing (either upper or lower)", URL: "https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/", - Detail: "Command 'FROM' should match the case of the command majority (lowercase)", + Detail: "Command 'FROM' should match the case of the majority of commands (lowercase)", Line: 4, Level: 1, }, @@ -1056,7 +1056,7 @@ RUN echo $foo RuleName: "UndefinedVar", Description: "Variables should be defined before their use", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-var/", - Detail: "Usage of undefined variable '$foo'", + Detail: "Usage of undefined variable $foo", Level: 1, Line: 3, }, @@ -1079,7 +1079,7 @@ COPY $DIR_ASSET . RuleName: "UndefinedVar", Description: "Variables should be defined before their use", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-var/", - Detail: "Usage of undefined variable '$DIR_ASSET' (did you mean $DIR_ASSETS?)", + Detail: "Usage of undefined variable $DIR_ASSET (did you mean $DIR_ASSETS?)", Level: 1, Line: 6, }, @@ -1099,7 +1099,7 @@ ENV PATH=$PAHT:/tmp/bin RuleName: "UndefinedVar", Description: "Variables should be defined before their use", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-var/", - Detail: "Usage of undefined variable '$PAHT' (did you mean $PATH?)", + Detail: "Usage of undefined variable $PAHT (did you mean $PATH?)", Level: 1, Line: 3, }, @@ -1187,7 +1187,7 @@ LABEL key value RuleName: "LegacyKeyValueFormat", Description: "Legacy key/value format with whitespace separator should not be used", URL: "https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/", - Detail: "\"ENV key=value\" should be used instead of legacy \"ENV key value\" format", + Detail: "`ENV key=value` should be used instead of legacy `ENV key value` format", Line: 3, Level: 1, }, @@ -1195,7 +1195,7 @@ LABEL key value RuleName: "LegacyKeyValueFormat", Description: "Legacy key/value format with whitespace separator should not be used", URL: "https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/", - Detail: "\"LABEL key=value\" should be used instead of legacy \"LABEL key value\" format", + Detail: "`LABEL key=value` should be used instead of legacy `LABEL key value` format", Line: 4, Level: 1, }, @@ -1227,7 +1227,7 @@ FROM a AS c RuleName: "LegacyKeyValueFormat", Description: "Legacy key/value format with whitespace separator should not be used", URL: "https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/", - Detail: "\"ENV key=value\" should be used instead of legacy \"ENV key value\" format", + Detail: "`ENV key=value` should be used instead of legacy `ENV key value` format", Line: 3, Level: 1, }, @@ -1235,7 +1235,7 @@ FROM a AS c RuleName: "LegacyKeyValueFormat", Description: "Legacy key/value format with whitespace separator should not be used", URL: "https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/", - Detail: "\"LABEL key=value\" should be used instead of legacy \"LABEL key value\" format", + Detail: "`LABEL key=value` should be used instead of legacy `LABEL key value` format", Line: 4, Level: 1, }, diff --git a/frontend/dockerfile/docs/rules/_index.md b/frontend/dockerfile/docs/rules/_index.md index 0938ace3dfe8..d20565dad7ba 100644 --- a/frontend/dockerfile/docs/rules/_index.md +++ b/frontend/dockerfile/docs/rules/_index.md @@ -37,7 +37,7 @@ To learn more about how to use build checks, see FromAsCasing - The 'as' keyword should match the case of the 'from' keyword + The AS keyword should match the case of the FROM keyword NoEmptyContinuation diff --git a/frontend/dockerfile/docs/rules/from-as-casing.md b/frontend/dockerfile/docs/rules/from-as-casing.md index 03506c0ac80a..9154c31e4dc8 100644 --- a/frontend/dockerfile/docs/rules/from-as-casing.md +++ b/frontend/dockerfile/docs/rules/from-as-casing.md @@ -1,7 +1,7 @@ --- title: FromAsCasing description: >- - The 'as' keyword should match the case of the 'from' keyword + The AS keyword should match the case of the FROM keyword aliases: - /go/dockerfile/rule/from-as-casing/ --- @@ -9,7 +9,7 @@ aliases: ## Output ```text -'as' and 'FROM' keywords' casing do not match +'as' and 'FROM' keywords' casing does not match ``` ## Description @@ -42,4 +42,3 @@ from debian:latest as deb-builder ## Related errors - [`FileConsistentCommandCasing`](./consistent-instruction-casing.md) - diff --git a/frontend/dockerfile/docs/rules/legacy-key-value-format.md b/frontend/dockerfile/docs/rules/legacy-key-value-format.md index dc43b53cb736..38eb49c956a2 100644 --- a/frontend/dockerfile/docs/rules/legacy-key-value-format.md +++ b/frontend/dockerfile/docs/rules/legacy-key-value-format.md @@ -9,7 +9,7 @@ aliases: ## Output ```text -"ENV key=value" should be used instead of legacy "ENV key value" format +`ENV key=value` should be used instead of legacy `ENV key value` format ``` ## Description diff --git a/frontend/dockerfile/docs/rules/undefined-var.md b/frontend/dockerfile/docs/rules/undefined-var.md index f44ae6960a20..cdd823ae3a95 100644 --- a/frontend/dockerfile/docs/rules/undefined-var.md +++ b/frontend/dockerfile/docs/rules/undefined-var.md @@ -9,7 +9,7 @@ aliases: ## Output ```text -Usage of undefined variable '$foo' +Usage of undefined variable $foo ``` ## Description @@ -35,7 +35,7 @@ ENV PATH=$PAHT:/app/bin The check identifies that `$PAHT` is undefined and likely a typo for `$PATH`: ```text -Usage of undefined variable '$PAHT' (did you mean $PATH?) +Usage of undefined variable $PAHT (did you mean $PATH?) ``` ## Examples diff --git a/frontend/dockerfile/linter/docs/FromAsCasing.md b/frontend/dockerfile/linter/docs/FromAsCasing.md index a92a47e0a91f..99338024cdb9 100644 --- a/frontend/dockerfile/linter/docs/FromAsCasing.md +++ b/frontend/dockerfile/linter/docs/FromAsCasing.md @@ -1,7 +1,7 @@ ## Output ```text -'as' and 'FROM' keywords' casing do not match +'as' and 'FROM' keywords' casing does not match ``` ## Description diff --git a/frontend/dockerfile/linter/docs/LegacyKeyValueFormat.md b/frontend/dockerfile/linter/docs/LegacyKeyValueFormat.md index b54f3d8ea9dd..e929572f7ba9 100644 --- a/frontend/dockerfile/linter/docs/LegacyKeyValueFormat.md +++ b/frontend/dockerfile/linter/docs/LegacyKeyValueFormat.md @@ -1,7 +1,7 @@ ## Output ```text -"ENV key=value" should be used instead of legacy "ENV key value" format +`ENV key=value` should be used instead of legacy `ENV key value` format ``` ## Description diff --git a/frontend/dockerfile/linter/docs/UndefinedVar.md b/frontend/dockerfile/linter/docs/UndefinedVar.md index 32c005b2b00d..a3e1a5c85f7d 100644 --- a/frontend/dockerfile/linter/docs/UndefinedVar.md +++ b/frontend/dockerfile/linter/docs/UndefinedVar.md @@ -1,7 +1,7 @@ ## Output ```text -Usage of undefined variable '$foo' +Usage of undefined variable $foo ``` ## Description @@ -27,7 +27,7 @@ ENV PATH=$PAHT:/app/bin The check identifies that `$PAHT` is undefined and likely a typo for `$PATH`: ```text -Usage of undefined variable '$PAHT' (did you mean $PATH?) +Usage of undefined variable $PAHT (did you mean $PATH?) ``` ## Examples diff --git a/frontend/dockerfile/linter/ruleset.go b/frontend/dockerfile/linter/ruleset.go index 63cc0013ef2b..7a5d49ae086a 100644 --- a/frontend/dockerfile/linter/ruleset.go +++ b/frontend/dockerfile/linter/ruleset.go @@ -15,10 +15,10 @@ var ( } RuleFromAsCasing = LinterRule[func(string, string) string]{ Name: "FromAsCasing", - Description: "The 'as' keyword should match the case of the 'from' keyword", + Description: "The AS keyword should match the case of the FROM keyword", URL: "https://docs.docker.com/go/dockerfile/rule/from-as-casing/", Format: func(from, as string) string { - return fmt.Sprintf("'%s' and '%s' keywords' casing do not match", as, from) + return fmt.Sprintf("'%s' and '%s' keywords' casing does not match", as, from) }, } RuleNoEmptyContinuation = LinterRule[func() string]{ @@ -34,7 +34,7 @@ var ( Description: "All commands within the Dockerfile should use the same casing (either upper or lower)", URL: "https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/", Format: func(violatingCommand, correctCasing string) string { - return fmt.Sprintf("Command '%s' should match the case of the command majority (%s)", violatingCommand, correctCasing) + return fmt.Sprintf("Command '%s' should match the case of the majority of commands (%s)", violatingCommand, correctCasing) }, } RuleDuplicateStageName = LinterRule[func(string) string]{ @@ -42,7 +42,7 @@ var ( Description: "Stage names should be unique", URL: "https://docs.docker.com/go/dockerfile/rule/duplicate-stage-name/", Format: func(stageName string) string { - return fmt.Sprintf("Duplicate stage name %q, stage names should be unique", stageName) + return fmt.Sprintf("Duplicate stage name '%q', stage names should be unique", stageName) }, } RuleReservedStageName = LinterRule[func(string) string]{ @@ -50,7 +50,7 @@ var ( Description: "Reserved words should not be used as stage names", URL: "https://docs.docker.com/go/dockerfile/rule/reserved-stage-name/", Format: func(reservedStageName string) string { - return fmt.Sprintf("Stage name should not use the same name as reserved stage %q", reservedStageName) + return fmt.Sprintf("Stage name should not use the same name as the reserved stage %q", reservedStageName) }, } RuleJSONArgsRecommended = LinterRule[func(instructionName string) string]{ @@ -74,19 +74,19 @@ var ( Description: "FROM command must use declared ARGs", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-arg-in-from/", Format: func(baseArg, suggest string) string { - out := fmt.Sprintf("FROM argument '%s' is not declared", baseArg) + out := fmt.Sprintf("FROM argument $%s is not declared", baseArg) if suggest != "" { - out += fmt.Sprintf(" (did you mean %s?)", suggest) + out += fmt.Sprintf(" (did you mean $%s?)", suggest) } return out }, } RuleWorkdirRelativePath = LinterRule[func(workdir string) string]{ Name: "WorkdirRelativePath", - Description: "Relative workdir without an absolute workdir declared within the build can have unexpected results if the base image changes", + Description: "Relative WORKDIR without an absolute WORKDIR declared within the build can have unexpected results if the base image changes", URL: "https://docs.docker.com/go/dockerfile/rule/workdir-relative-path/", Format: func(workdir string) string { - return fmt.Sprintf("Relative workdir %q can have unexpected results if the base image changes", workdir) + return fmt.Sprintf("Relative WORKDIR %q can have unexpected results if the base image changes", workdir) }, } RuleUndefinedVar = LinterRule[func(string, string) string]{ @@ -94,7 +94,7 @@ var ( Description: "Variables should be defined before their use", URL: "https://docs.docker.com/go/dockerfile/rule/undefined-var/", Format: func(arg, suggest string) string { - out := fmt.Sprintf("Usage of undefined variable '$%s'", arg) + out := fmt.Sprintf("Usage of undefined variable $%s", arg) if suggest != "" { out += fmt.Sprintf(" (did you mean $%s?)", suggest) } @@ -114,14 +114,14 @@ var ( Description: "Legacy key/value format with whitespace separator should not be used", URL: "https://docs.docker.com/go/dockerfile/rule/legacy-key-value-format/", Format: func(cmdName string) string { - return fmt.Sprintf("\"%s key=value\" should be used instead of legacy \"%s key value\" format", cmdName, cmdName) + return fmt.Sprintf("`%s key=value` should be used instead of legacy `%s key value` format", cmdName, cmdName) }, } RuleInvalidBaseImagePlatform = LinterRule[func(string, string, string) string]{ Name: "InvalidBaseImagePlatform", Description: "Base image platform does not match expected target platform", Format: func(image, expected, actual string) string { - return fmt.Sprintf("Base image %s was pulled with platform %q, expected %q for current build", image, actual, expected) + return fmt.Sprintf("Base image '%s' was pulled with platform '%q', expected '%q' for current build", image, actual, expected) }, } RuleRedundantTargetPlatform = LinterRule[func(string) string]{ @@ -153,15 +153,15 @@ var ( Description: "FROM --platform flag should not use a constant value", URL: "https://docs.docker.com/go/dockerfile/rule/from-platform-flag-const-disallowed/", Format: func(platform string) string { - return fmt.Sprintf("FROM --platform flag should not use constant value %q", platform) + return fmt.Sprintf("FROM --platform flag should not use constant value '%q'", platform) }, } RuleCopyIgnoredFile = LinterRule[func(string, string) string]{ Name: "CopyIgnoredFile", - Description: "Attempting to Copy file that is excluded by .dockerignore", + Description: "Attempting to COPY/ADD file that is excluded by .dockerignore", URL: "https://docs.docker.com/go/dockerfile/rule/copy-ignored-file/", Format: func(cmd, file string) string { - return fmt.Sprintf("Attempting to %s file %q that is excluded by .dockerignore", cmd, file) + return fmt.Sprintf("Attempting to %s file '%q' that is excluded by .dockerignore", cmd, file) }, Experimental: true, }