From 0e516cc8d1053695b0a3984b61a1b8472dd493fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Fri, 18 Apr 2014 11:11:29 +0200 Subject: [PATCH] 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 Change-Id: I470e1fdfc38a3f3c7ba5644c5103f2a9ef073005 --- bin/dib-lint | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/dib-lint b/bin/dib-lint index 57f929c7..2ba03a74 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -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