From c1985ea7720823464acdf9872eaf29b7176a6f94 Mon Sep 17 00:00:00 2001 From: Ryan Brady Date: Thu, 24 Jul 2014 13:50:48 -0400 Subject: [PATCH] Add dib-lint exclusions This patch adds exclusions for the indentation and newline rules in dib-lint. The indentation exclusion is needed for files using heredoc and wanting to preserve indentation. The newline exclusion is added here for consisently treating all dib-lint rules the same. Change-Id: Ic8a2164eba3cf99e55473846e3a5fe663a3c1095 --- bin/dib-lint | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/bin/dib-lint b/bin/dib-lint index 35c26fb0f..c49d291b3 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -118,12 +118,16 @@ done for i in $(find elements -type f -and -name '*.md' -or -type f -executable); do # Check for tab indentation - if grep -q $'^ *\t' ${i}; then - error "$i contains tab characters" + if ! excluded indent; then + if grep -q $'^ *\t' ${i}; then + error "$i contains tab characters" + fi fi - if [ "$(tail -c 1 $i)" != "" ]; then - error "No newline at end of file: $i" + if ! excluded newline; then + if [ "$(tail -c 1 $i)" != "" ]; then + error "No newline at end of file: $i" + fi fi done exit $rc