aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMartin André <m.andre@redhat.com>2017-12-05 10:48:08 +0100
committerMartin André <m.andre@redhat.com>2017-12-05 10:53:49 +0100
commit3364720f3435a7e5469e0f1ed0bce4c02e70af9d (patch)
tree82a04878ac2f36013baefee094ea249810252750 /tools
parente38683d2123b446c34d869912404b662bd56efa9 (diff)
downloadkolla-3364720f3435a7e5469e0f1ed0bce4c02e70af9d.tar.gz
kolla-3364720f3435a7e5469e0f1ed0bce4c02e70af9d.zip
Validate Dockerfile indentation in pep8
Delegate code style validation to computers, they're better than human at it :) This commit adds a new `tools/validate-indentation.sh` script that errors when it finds an indented Dockerfile instruction, and enables the validation in the pep8 check. Also adjust the logic of `tools/validate-all-dockerfiles.sh` so that it doesn't stop on first errors but instead shows all of them. Fixes the remaining indentations in Dockerfiles. Change-Id: I53c0d38304cb4f6d64a5dfab67f70d69b3eae587
Diffstat (limited to 'tools')
-rwxr-xr-xtools/validate-all-dockerfiles.sh10
-rwxr-xr-xtools/validate-indentation.sh12
2 files changed, 20 insertions, 2 deletions
diff --git a/tools/validate-all-dockerfiles.sh b/tools/validate-all-dockerfiles.sh
index 5a39d24c0..a2b33ff10 100755
--- a/tools/validate-all-dockerfiles.sh
+++ b/tools/validate-all-dockerfiles.sh
@@ -3,9 +3,15 @@
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
cd "$(dirname "$REAL_PATH")/.."
+RES=0
+
+find docker -name Dockerfile.j2 -print0 |
+ xargs -0 tools/validate-maintainer.sh || RES=1
+
find docker -name Dockerfile.j2 -print0 |
- xargs -0 tools/validate-maintainer.sh || exit 1
+ xargs -0 tools/validate-install-command.sh || RES=1
find docker -name Dockerfile.j2 -print0 |
- xargs -0 tools/validate-install-command.sh || exit 1
+ xargs -0 tools/validate-indentation.sh || RES=1
+exit $RES
diff --git a/tools/validate-indentation.sh b/tools/validate-indentation.sh
new file mode 100755
index 000000000..de2f20c6f
--- /dev/null
+++ b/tools/validate-indentation.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+RES=0
+
+for dockerfile in "$@"; do
+ if grep -qE '^\s+[A-Z]+\s' "$dockerfile"; then
+ echo "ERROR: $dockerfile has indented Dockerfile instruction" >&2
+ RES=1
+ fi
+done
+
+exit $RES