-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rule for arg / stage name comment descriptions
Signed-off-by: Talon Bowler <[email protected]>
- Loading branch information
Showing
6 changed files
with
227 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
frontend/dockerfile/docs/rules/invalid-definition-description.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
title: InvalidDefinitionDescription | ||
description: Comment for stage/arg should follow the format: `# <arg/stage name> <description>`. If this is not intended to be a description comment, add an empty line/comment between them. | ||
aliases: | ||
- /go/dockerfile/rule/invalid-definition-description/ | ||
--- | ||
|
||
## Output | ||
|
||
```text | ||
Comment for stage/arg should follow the format: `# <arg/stage name> <description>`. If this is not intended to be a description comment, add an empty line/comment between them. | ||
``` | ||
|
||
## Description | ||
|
||
When using `docker build` in conjunction with the `--check=outline` or `--check=targets` arguments, `buildx` can parse comments to show descriptions for arguments and stages. This functionality relies on the descriptive comments being particularly formatted. In the cases where comments immediately preceding the `FROM` or `ARG` commands are not meant to be descriptions, add an empty line / comment between them. | ||
|
||
## Examples | ||
|
||
❌ Bad: A non-descriptive comment on the line preceding the `FROM` command. | ||
|
||
```dockerfile | ||
# a non-descriptive comment | ||
FROM scratch AS base | ||
|
||
# another non-descriptive comment | ||
ARG VERSION=1 | ||
``` | ||
|
||
✅ Good: An empty line separating non-descriptive comments. | ||
|
||
```dockerfile | ||
# a non-descriptive comment | ||
|
||
FROM scratch AS base | ||
|
||
# another non-descriptive comment | ||
|
||
ARG VERSION=1 | ||
``` | ||
|
||
✅ Good: Comments describing `ARG` keys and stages immediately proceeding the command. | ||
|
||
```dockerfile | ||
# base This is the base stage. | ||
FROM scratch AS base | ||
# VERSION This is the version number. | ||
ARG VERSION=1 | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.