Commit a5e5e849 authored by David Enyeart's avatar David Enyeart Committed by Gerrit Code Review
Browse files

Merge "[FAB-12702] Check trailing spaces on local build"

parents ddbec02e e6081b59
......@@ -36,7 +36,7 @@
# - clean-all - superset of 'clean' that also removes persistent state
# - dist-clean - clean release packages for all target platforms
# - unit-test-clean - cleans unit test state (particularly from docker)
# - basic-checks - performs basic checks like license, spelling and linter
# - basic-checks - performs basic checks like license, spelling, trailing spaces and linter
# - enable_ci_only_tests - triggers unit-tests in downstream jobs. Applicable only for CI not to
# use in the local machine.
# - docker-thirdparty - pulls thirdparty images (kafka,zookeeper,couchdb)
......@@ -115,7 +115,7 @@ all: native docker checks
checks: basic-checks unit-test integration-test
basic-checks: license spelling linter
basic-checks: license spelling trailing-spaces linter
desk-check: checks verify
......@@ -140,6 +140,10 @@ spelling:
license:
@scripts/check_license.sh
.PHONY: trailing-spaces
trailing-spaces:
@scripts/check_trailingspaces.sh
include gotools.mk
.PHONY: gotools
......
#!/bin/bash
# Copyright Hitachi, Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
COMMIT_FILES=`git diff --name-only --diff-filter=ACMRTUXB HEAD | grep -Ev '(^|/)vendor/'`
echo "Checking trailing spaces ..."
for filename in `echo $COMMIT_FILES`; do
if [[ `file $filename` == *"ASCII text"* ]];
then
if [ ! -z "`egrep -l " +$" $filename`" ];
then
FOUND_TRAILING='yes'
echo "Error: Trailing spaces found in file:$filename, lines:"
egrep -n " +$" $filename
fi
fi
done
if [ ! -z ${FOUND_TRAILING+x} ];
then
echo "Please omit trailing spaces and make again."
exit 1
fi
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment