Skip to content

Commit a62980e

Browse files
committed
Add note in generated docs indicating experimental rule checks
Signed-off-by: Talon Bowler <[email protected]>
1 parent 8a7ba6e commit a62980e

File tree

4 files changed

+24
-7
lines changed

4 files changed

+24
-7
lines changed

frontend/dockerfile/docs/rules/_index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ $ docker build --check .
9797
<td>FROM --platform flag should not use a constant value</td>
9898
</tr>
9999
<tr>
100-
<td><a href="./copy-ignored-file/">CopyIgnoredFile</a></td>
100+
<td><a href="./copy-ignored-file/">CopyIgnoredFile (experimental)</a></td>
101101
<td>Attempting to Copy file that is excluded by .dockerignore</td>
102102
</tr>
103103
</tbody>

frontend/dockerfile/docs/rules/copy-ignored-file.md

+5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ aliases:
55
- /go/dockerfile/rule/copy-ignored-file/
66
---
77

8+
> **Note**
9+
>
10+
> This check is experimental and is not enabled by default. To enable it, see
11+
> [Experimental checks](https://docs.docker.com/go/build-checks-experimental/).
12+
813
## Output
914

1015
```text

frontend/dockerfile/linter/docs/_index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $ docker build --check .
3030
<tbody>
3131
{{- range .Rules }}
3232
<tr>
33-
<td><a href="./{{ .PageName }}/">{{ .Name }}</a></td>
33+
<td><a href="./{{ .PageName }}/">{{ .Name }}{{- if .Experimental }} (experimental){{- end}}</a></td>
3434
<td>{{ .Description }}</td>
3535
</tr>
3636
{{- end }}

frontend/dockerfile/linter/generate.go

+17-5
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@ import (
2020
)
2121

2222
type Rule struct {
23-
Name string
24-
Description string
25-
URL *url.URL
26-
PageName string
27-
URLAlias string
23+
Name string
24+
Description string
25+
URL *url.URL
26+
PageName string
27+
URLAlias string
28+
Experimental bool
2829
}
2930

3031
const tmplStr = `---
@@ -35,6 +36,13 @@ aliases:
3536
- {{ .Rule.URLAlias }}
3637
{{- end }}
3738
---
39+
{{- if .Rule.Experimental }}
40+
41+
> **Note**
42+
>
43+
> This check is experimental and is not enabled by default. To enable it, see
44+
> [Experimental checks](https://docs.docker.com/go/build-checks-experimental/).
45+
{{- end }}
3846
3947
{{ .Content }}
4048
`
@@ -160,6 +168,10 @@ func listRules() ([]Rule, error) {
160168
}
161169
rule.URL = u
162170
}
171+
case "Experimental":
172+
if basicLit, ok := kv.Value.(*ast.Ident); ok {
173+
rule.Experimental = basicLit.Name == "true"
174+
}
163175
}
164176
}
165177
}

0 commit comments

Comments
 (0)