moby--moby/hack/validate/toml

32 lines
734 B
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env bash
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPTDIR}/.validate"
IFS=$'\n'
files=($(validate_diff --diff-filter=ACMR --name-only -- 'MAINTAINERS' || true))
unset IFS
badFiles=()
for f in "${files[@]}"; do
hack/validate: clean-up output, move golang-ci-lint to end The golang-ci-lint takes longest to run, so do the other checks first; this also makes the output a bit more readable. While at it, fix some consistency issues in the output of the other checks. Before this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Congratulations! "./pkg/..." is safely isolated from internal code. The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All api changes are done the right way. Congratulations! All toml source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. After this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. Congratulations! Packages in "./pkg/..." are safely isolated from internal code. Congratulations! The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All API changes are done the right way. Congratulations! All TOML source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. Congratulations! No new tests were added to integration-cli. INFO Start validation with golang-ci-lint INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-11 11:31:18 +00:00
# we use "git show" here to validate that what's committed has valid TOML syntax
if ! git show "$VALIDATE_HEAD:$f" | tomll /proc/self/fd/0; then
badFiles+=("$f")
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
hack/validate: clean-up output, move golang-ci-lint to end The golang-ci-lint takes longest to run, so do the other checks first; this also makes the output a bit more readable. While at it, fix some consistency issues in the output of the other checks. Before this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Congratulations! "./pkg/..." is safely isolated from internal code. The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All api changes are done the right way. Congratulations! All toml source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. After this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. Congratulations! Packages in "./pkg/..." are safely isolated from internal code. Congratulations! The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All API changes are done the right way. Congratulations! All TOML source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. Congratulations! No new tests were added to integration-cli. INFO Start validation with golang-ci-lint INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-11 11:31:18 +00:00
echo 'Congratulations! All TOML source files changed here have valid syntax.'
else
{
hack/validate: clean-up output, move golang-ci-lint to end The golang-ci-lint takes longest to run, so do the other checks first; this also makes the output a bit more readable. While at it, fix some consistency issues in the output of the other checks. Before this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Congratulations! "./pkg/..." is safely isolated from internal code. The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All api changes are done the right way. Congratulations! All toml source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. After this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. Congratulations! Packages in "./pkg/..." are safely isolated from internal code. Congratulations! The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All API changes are done the right way. Congratulations! All TOML source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. Congratulations! No new tests were added to integration-cli. INFO Start validation with golang-ci-lint INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-11 11:31:18 +00:00
echo "These files are not valid TOML:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
hack/validate: clean-up output, move golang-ci-lint to end The golang-ci-lint takes longest to run, so do the other checks first; this also makes the output a bit more readable. While at it, fix some consistency issues in the output of the other checks. Before this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Congratulations! "./pkg/..." is safely isolated from internal code. The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All api changes are done the right way. Congratulations! All toml source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. After this change: TEST_FORCE_VALIDATE=1 hack/validate/default Congratulations! All commits are properly signed with the DCO! Congratulations! Seccomp profile generation is done correctly. Congratulations! Packages in "./pkg/..." are safely isolated from internal code. Congratulations! The swagger spec at "api/swagger.yaml" is valid against swagger specification 2.0 Congratulations! All API changes are done the right way. Congratulations! All TOML source files changed here have valid syntax. Congratulations! Changelog CHANGELOG.md is well-formed. Congratulations! Changelog CHANGELOG.md dates are in descending order. Congratulations! No new tests were added to integration-cli. INFO Start validation with golang-ci-lint INFO [config_reader] Used config file hack/validate/golangci-lint.yml INFO [lintersdb] Active 15 linters: [deadcode gofmt goimports golint gosec gosimple govet ineffassign misspell staticcheck structcheck typecheck unconvert unused varcheck] ... INFO Execution took 2m12.4287302s Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-10-11 11:31:18 +00:00
echo 'Please reformat the above files as valid TOML'
echo
} >&2
false
fi