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
This commit is contained in:
parent
bbea877f2c
commit
e678910166
@ -63,6 +63,7 @@ TMPDIR=$(mktemp -d /tmp/tmp.XXXXXXXXXX)
|
|||||||
trap "rm -rf $TMPDIR" EXIT
|
trap "rm -rf $TMPDIR" EXIT
|
||||||
for i in $(find elements -type f \
|
for i in $(find elements -type f \
|
||||||
-not -name \*~ \
|
-not -name \*~ \
|
||||||
|
-not -name \*.orig \
|
||||||
-not -name \*.rst \
|
-not -name \*.rst \
|
||||||
-not -name \*.yaml \
|
-not -name \*.yaml \
|
||||||
-not -name \*.py \
|
-not -name \*.py \
|
||||||
@ -81,8 +82,11 @@ for i in $(find elements -type f \
|
|||||||
flake8 $i
|
flake8 $i
|
||||||
else
|
else
|
||||||
if ! excluded indent ; then
|
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"
|
error "$i should use 4 spaces indent"
|
||||||
|
# outline the failing lines with line number
|
||||||
|
grep -n "$indent_regex" ${i}
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user