diff --git a/bin/dib-lint b/bin/dib-lint index a4b1cfe89..01b28c398 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -19,6 +19,8 @@ # common mistakes and exits with a non-zero status if it finds any. rc=0 +TMPDIR=$(mktemp -d) +trap "rm -rf $TMPDIR" EXIT for i in $(find elements -type f); do # Check that files starting with a shebang are +x firstline=$(head -n 1 "$i") @@ -26,5 +28,18 @@ for i in $(find elements -type f); do echo "ERROR: $i is not executable" rc=1 fi + + # Check alphabetical ordering of element-deps + if [ $(basename $i) = "element-deps" ]; then + UNSORTED=${TMPDIR}/element-deps.unsorted + SORTED=${TMPDIR}/element-deps.sorted + grep -v '^#' $i > ${UNSORTED} + sort ${UNSORTED} > ${SORTED} + diff -c ${UNSORTED} ${SORTED} + if [ $? -ne 0 ]; then + echo "ERROR: $i is not sorted alphabetically" + rc=1 + fi + fi done exit $rc \ No newline at end of file