dib-lint: make it work on Mac OS X

Pass an explicit template to mktemp since that is required on Mac OS X.
Hardcoded to /tmp since I did not want to bother validating TMPDIR which
is user supplied.

Explicit define a repeating group which causes a grep error:
    repetition-operator operand invalid

Change-Id: Ib23cc15db7f7dfdd611280884e46342562d545df
This commit is contained in:
Antoine Musso 2015-06-18 11:07:05 +02:00
parent c9f44b29bb
commit 35584efa90

View File

@ -59,7 +59,7 @@ error() {
}
rc=0
TMPDIR=$(mktemp -d)
TMPDIR=$(mktemp -d /tmp/tmp.XXXXXXXXXX)
trap "rm -rf $TMPDIR" EXIT
for i in $(find elements -type f \
-not -name \*~ \
@ -80,7 +80,7 @@ for i in $(find elements -type f \
flake8 $i
else
if ! excluded indent ; then
if grep -q "^ \{4\}* \{1,3\}[^ ]" ${i}; then
if grep -q "^\( \{4\}\)* \{1,3\}[^ ]" ${i}; then
error "$i should use 4 spaces indent"
fi
fi