Open atc0005 opened 2 years ago
https://github.com/adrienverge/yamllint seems like it might do the job.
A recent enough version is available for installation via apt
repos, or via pip
for the latest version.
$ docker run -it --rm -v $PWD:$PWD -w $PWD ghcr.io/atc0005/go-ci:go-ci-stable
root@a5d5a7803615:/home/ubuntu/Desktop/go-ci# ls -la
total 116
drwxrwxr-x 8 1000 1000 4096 Jun 19 13:48 .
drwxr-xr-x 3 root root 4096 Jun 20 10:22 ..
drwxrwxr-x 8 1000 1000 4096 Jun 20 10:11 .git
drwxrwxr-x 3 1000 1000 4096 Apr 25 10:07 .github
-rw-rw-r-- 1 1000 1000 446 Nov 29 2020 .gitignore
-rw-rw-r-- 1 1000 1000 676 Jun 19 12:46 .markdownlint.yml
-rw-rw-r-- 1 1000 1000 41928 Jun 2 11:48 CHANGELOG.md
-rw-rw-r-- 1 1000 1000 1070 Jul 30 2020 LICENSE
-rw-rw-r-- 1 1000 1000 17950 Jun 19 13:48 Makefile
-rw-rw-r-- 1 1000 1000 7892 Jun 19 13:48 README.md
drwxrwxr-x 2 1000 1000 4096 Jun 20 10:18 oldstable
drwxrwxr-x 5 1000 1000 4096 Jun 20 10:03 stable
drwxrwxr-x 2 1000 1000 4096 Jun 19 13:48 tools
drwxrwxr-x 2 1000 1000 4096 Jun 20 10:18 unstable
root@a5d5a7803615:/home/ubuntu/Desktop/go-ci# yamllint ./.markdownlint.yml
./.markdownlint.yml
13:1 warning missing document start "---" (document-start)
root@a5d5a7803615:/home/ubuntu/Desktop/go-ci# echo $?
0
root@a5d5a7803615:/home/ubuntu/Desktop/go-ci# yamllint ./stable/.golangci.yml
./stable/.golangci.yml
15:1 warning missing document start "---" (document-start)
28:81 error line too long (103 > 80 characters) (line-length)
86:81 error line too long (82 > 80 characters) (line-length)
87:81 error line too long (82 > 80 characters) (line-length)
root@a5d5a7803615:/home/ubuntu/Desktop/go-ci# echo $?
1
root@a5d5a7803615:/home/ubuntu/Desktop/go-ci# yamllint ./stable/.golangci.yml
./stable/.golangci.yml
15:1 warning missing document start "---" (document-start)
28:81 error line too long (103 > 80 characters) (line-length)
root@a5d5a7803615:/home/ubuntu/Desktop/go-ci# yamllint ./stable/.golangci.yml
./stable/.golangci.yml
15:1 warning missing document start "---" (document-start)
This is from a local build of what will be the v0.6.14 version of the go-ci-stable
image.
The errors were resolved by fixing the line length:
diff --git a/stable/.golangci.yml b/stable/.golangci.yml
index 6c3a6b0..ab5ece2 100644
--- a/stable/.golangci.yml
+++ b/stable/.golangci.yml
@@ -25,7 +25,10 @@ issues:
run:
# Define the Go version limit.
# Mainly related to generics support in go1.18.
- # Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
+ #
+ # Default: use Go version from the go.mod file, fallback on the env var
+ # `GOVERSION`, fallback on 1.17
+ #
# https://github.com/golangci/golangci-lint/blob/master/.golangci.reference.yml
go: "1.18"
@@ -83,9 +86,9 @@ linters-settings:
enable-all: true
disable:
#
- # Disable fieldalignment settings until the Go team offers more control over
- # the types of checks provided by the fieldalignment linter or golangci-lint
- # does so.
+ # Disable fieldalignment settings until the Go team offers more control
+ # over the types of checks provided by the fieldalignment linter or
+ # golangci-lint does so.
#
# See https://github.com/atc0005/go-ci/issues/302 for more information.
#
FWIW, yamllint
doesn't flag this out of the box:
run:
go: 1.18
whereas the https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml VSCode extension does:
The https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml extension might be a resource that can be leveraged here.