From d08a3812d29c1245c647aebabec050090bcf5197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 21 Mar 2016 14:55:32 +0100 Subject: [PATCH] Use contents of local checkout instead of last commit for validation Validating only committed files is not useful in the natural $test_everything_passes; commit; push workflow; the failures will not be caught locally, only by Travis later (and only if PRs are used instead of direct commits to master). So, use the working directory state instead of last commit for validations; and remove misleading comments in checks which already use the working directory state. --- hack/make/.validate | 4 +--- hack/make/validate-gofmt | 3 +-- hack/make/validate-lint | 1 - hack/make/validate-vet | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/hack/make/.validate b/hack/make/.validate index 09439fd2..3c59d16d 100644 --- a/hack/make/.validate +++ b/hack/make/.validate @@ -21,9 +21,7 @@ if [ -z "$VALIDATE_UPSTREAM" ]; then VALIDATE_COMMIT_DIFF="$VALIDATE_UPSTREAM...$VALIDATE_HEAD" validate_diff() { - if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then - git diff "$VALIDATE_COMMIT_DIFF" "$@" - fi + git diff "$VALIDATE_UPSTREAM" "$@" } validate_log() { if [ "$VALIDATE_UPSTREAM" != "$VALIDATE_HEAD" ]; then diff --git a/hack/make/validate-gofmt b/hack/make/validate-gofmt index 8fc88cc5..0f973f92 100755 --- a/hack/make/validate-gofmt +++ b/hack/make/validate-gofmt @@ -8,8 +8,7 @@ unset IFS badFiles=() for f in "${files[@]}"; do - # we use "git show" here to validate that what's committed is formatted - if [ "$(git show "$VALIDATE_HEAD:$f" | gofmt -s -l)" ]; then + if [ "$(gofmt -s -l < $f)" ]; then badFiles+=( "$f" ) fi done diff --git a/hack/make/validate-lint b/hack/make/validate-lint index f8cb9c9f..3674d723 100755 --- a/hack/make/validate-lint +++ b/hack/make/validate-lint @@ -11,7 +11,6 @@ unset IFS errors=() for f in "${files[@]}"; do - # we use "git show" here to validate that what's committed passes go lint failedLint=$(golint "$f") if [ "$failedLint" ]; then errors+=( "$failedLint" ) diff --git a/hack/make/validate-vet b/hack/make/validate-vet index e88f7549..39f4a2c1 100755 --- a/hack/make/validate-vet +++ b/hack/make/validate-vet @@ -8,7 +8,6 @@ unset IFS errors=() for f in "${files[@]}"; do - # we use "git show" here to validate that what's committed passes go vet failedVet=$(go vet "$f") if [ "$failedVet" ]; then errors+=( "$failedVet" )