indent: search for !=4 spaces indentation

With this change, dib-lint raises an error if when finding an element
using space indentation that is not multiple of 4.

Co-Authored-By: Jon-Paul Sullivan <jonpaul.sullivan@hp.com>

Change-Id: I470e1fdfc38a3f3c7ba5644c5103f2a9ef073005
This commit is contained in:
Gonéri Le Bouder 2014-04-18 11:11:29 +02:00
parent ea3f4dd459
commit 0e516cc8d1
1 changed files with 9 additions and 3 deletions

View File

@ -45,12 +45,18 @@ trap "rm -rf $TMPDIR" EXIT
for i in $(find elements -type f); do
exclusions=("$(parse_exclusions $i)")
# Check that files starting with a shebang are +x
if ! excluded executable; then
firstline=$(head -n 1 "$i")
if [ ! -x "$i" ] && [ "${firstline:0:2}" = "#!" ]; then
firstline=$(head -n 1 "$i")
if [ "${firstline:0:2}" = "#!" ]; then
if [ ! -x "$i" ] && ! excluded executable; then
echo "ERROR: $i is not executable"
rc=1
fi
# Ensure 4 spaces indent are used
if grep -q "^ \{4\}* \{1,3\}[^ ]" ${i}; then
echo "ERROR: $i should use 4 spaces indent"
rc=1
fi
fi
# Check alphabetical ordering of element-deps