From e678910166f25851cf02713ed043fd0e8171b614 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 24 Sep 2015 20:51:07 +1000 Subject: [PATCH] Output failing lines when dib-lint finds wrong indents When dib-lint complains about wrong indents, it doesn't give you any indication where the problem is. This repeats the grep on failure, outputting the line and line-number. As a bonus, skip *.orig files from merges Change-Id: Ifbbdf854ea19191f66e9823468dbc0afc2f93e1f --- bin/dib-lint | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/dib-lint b/bin/dib-lint index a9b2df44..03651a48 100755 --- a/bin/dib-lint +++ b/bin/dib-lint @@ -63,6 +63,7 @@ TMPDIR=$(mktemp -d /tmp/tmp.XXXXXXXXXX) trap "rm -rf $TMPDIR" EXIT for i in $(find elements -type f \ -not -name \*~ \ + -not -name \*.orig \ -not -name \*.rst \ -not -name \*.yaml \ -not -name \*.py \ @@ -81,8 +82,11 @@ for i in $(find elements -type f \ flake8 $i else if ! excluded indent ; then - if grep -q "^\( \{4\}\)* \{1,3\}[^ ]" ${i}; then + indent_regex='^\( \{4\}\)* \{1,3\}[^ ]' + if grep -q "$indent_regex" ${i}; then error "$i should use 4 spaces indent" + # outline the failing lines with line number + grep -n "$indent_regex" ${i} fi fi fi