Revert "Dealing with trailing whitespaces"

The validation script from #10681 is too pedantic, and does not handle
well situations like:

```
cat <<EOF   # or <<-EOF
	Whether the leading whitespace is stripped out or not by bash
	it should still be considered as valid.
EOF
```

This reverts commit 4e65c1c319.

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2015-03-25 09:56:49 -06:00
parent f08e9f44a9
commit 0252ad0adc
21 changed files with 111 additions and 145 deletions

View File

@ -77,7 +77,7 @@ test-docker-py: build
$(DOCKER_RUN_DOCKER) hack/make.sh binary test-docker-py
validate: build
$(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco validate-toml validate-spaces
$(DOCKER_RUN_DOCKER) hack/make.sh validate-gofmt validate-dco validate-toml
shell: build
$(DOCKER_RUN_DOCKER) bash

View File

@ -45,7 +45,6 @@ DEFAULT_BUNDLES=(
validate-dco
validate-gofmt
validate-toml
validate-spaces
binary

View File

@ -1,33 +0,0 @@
#!/bin/bash
source "$(dirname "$BASH_SOURCE")/.validate"
#Ignoring files from vendor/, builder/parser/testfiles*, docs/theme/mkdocs/tipuesearch*, ending with .md and .go
ignoreFiles='^builder/parser/testfiles*|^docs/theme/mkdocs/tipuesearch*|^vendor/|\.md$|\.go$'
IFS=$'\n'
files=( $(validate_diff --diff-filter=ACMR --name-only | grep -v "$ignoreFiles" || true) )
unset IFS
badFiles=()
for f in "${files[@]}"; do
if [ "$(git show "$VALIDATE_HEAD:$f" | grep '[[:space:]]$')" ]; then
badFiles+=( "$f" )
fi
done
if [ ${#badFiles[@]} -eq 0 ]; then
echo 'Congratulations! All text files are properly formatted.'
else
{
echo "These files have trailing whitespaces:"
for f in "${badFiles[@]}"; do
echo " - $f"
done
echo
echo 'Please reformat the above files using, for example:'
echo '"ex -sc "'"%s/[[:space:]]*$//g|x"'" file" and commit the result.'
echo
} >&2
false
fi