1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

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>
This commit is contained in:
Sebastiaan van Stijn 2019-10-11 13:31:18 +02:00
parent cd094422a7
commit 1f0fdcc6f5
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
8 changed files with 19 additions and 12 deletions

View file

@ -6,7 +6,6 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${SCRIPTDIR}"/dco
. "${SCRIPTDIR}"/default-seccomp
. "${SCRIPTDIR}"/golangci-lint
. "${SCRIPTDIR}"/pkg-imports
. "${SCRIPTDIR}"/swagger
. "${SCRIPTDIR}"/swagger-gen
@ -14,3 +13,4 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. "${SCRIPTDIR}"/changelog-well-formed
. "${SCRIPTDIR}"/changelog-date-descending
. "${SCRIPTDIR}"/deprecate-integration-cli
. "${SCRIPTDIR}"/golangci-lint

View file

@ -23,6 +23,6 @@ if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then
} >&2
false
else
echo 'Congratulations! Seccomp profile generation is done correctly.'
echo 'Congratulations! Seccomp profile generation is done correctly.'
fi
fi

View file

@ -21,5 +21,5 @@ if [ -n "$new_tests" ]; then
} >&2
false
else
echo 'Congratulations! No new tests added to integration-cli.'
echo 'Congratulations! No new tests were added to integration-cli.'
fi

View file

@ -17,6 +17,8 @@ elif ${PKG_CONFIG} 'libsystemd-journal' 2> /dev/null ; then
DOCKER_BUILDTAGS+=" journald journald_compat"
fi
echo -e "\n\033[0;36mINFO\033[0m Start validation with golang-ci-lint"
# TODO use --out-format=junit-xml and store artifacts
# shellcheck disable=SC2086
GOGC=75 golangci-lint run \

View file

@ -20,7 +20,7 @@ for f in "${files[@]}"; do
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! "./pkg/..." is safely isolated from internal code.'
echo 'Congratulations! Packages in "./pkg/..." are safely isolated from internal code.'
else
{
echo 'These files import internal code: (either directly or indirectly)'

View file

@ -9,5 +9,10 @@ unset IFS
if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then
LANG=C.UTF-8 yamllint -c "${SCRIPTDIR}"/.swagger-yamllint api/swagger.yaml
swagger validate api/swagger.yaml
if out=$(swagger validate api/swagger.yaml); then
echo "Congratulations! ${out}"
else
echo "${out}" >&2
false
fi
fi

View file

@ -17,12 +17,12 @@ if [ -n "${TEST_FORCE_VALIDATE:-}" ] || [ ${#files[@]} -gt 0 ]; then
echo
echo "$diffs"
echo
echo 'Please update api/swagger.yaml with any api changes, then '
echo 'run `hack/generate-swagger-api.sh`.'
echo 'Please update api/swagger.yaml with any API changes, then '
echo 'run hack/generate-swagger-api.sh.'
} >&2
false
else
echo 'Congratulations! All api changes are done the right way.'
echo 'Congratulations! All API changes are done the right way.'
fi
else
echo 'No api/types/ or api/swagger.yaml changes in diff.'

View file

@ -9,22 +9,22 @@ unset IFS
badFiles=()
for f in "${files[@]}"; do
# we use "git show" here to validate that what's committed has valid toml syntax
# we use "git show" here to validate that what's committed has valid TOML syntax
if ! git show "$VALIDATE_HEAD:$f" | tomlv /proc/self/fd/0 ; then
badFiles+=( "$f" )
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! All toml source files changed here have valid syntax.'
echo 'Congratulations! All TOML source files changed here have valid syntax.'
else
{
echo "These files are not valid toml:"
echo "These files are not valid TOML:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
echo 'Please reformat the above files as valid toml'
echo 'Please reformat the above files as valid TOML'
echo
} >&2
false