diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/Z99-cloud-locale-test.sh | 19 | ||||
-rwxr-xr-x | tools/run-pep8 | 14 | ||||
-rwxr-xr-x | tools/validate-yaml.py | 26 |
3 files changed, 50 insertions, 9 deletions
diff --git a/tools/Z99-cloud-locale-test.sh b/tools/Z99-cloud-locale-test.sh index 4012beeb..3c51f22d 100755 --- a/tools/Z99-cloud-locale-test.sh +++ b/tools/Z99-cloud-locale-test.sh @@ -10,10 +10,13 @@ # locale_warn() { - local cr=" -" - local bad_names="" bad_lcs="" key="" value="" var="" + local bad_names="" bad_lcs="" key="" val="" var="" vars="" local w1 w2 w3 w4 remain + + # if shell is zsh, act like sh only for this function (-L). + # The behavior change will not permenently affect user's shell. + [ "${ZSH_NAME+zsh}" = "zsh" ] && emulate -L sh + # locale is expected to output either: # VARIABLE= # VARIABLE="value" @@ -22,7 +25,7 @@ locale_warn() { case "$w1" in locale:) bad_names="${bad_names} ${w4}";; *) - key=${w1%%\=*} + key=${w1%%=*} val=${w1#*=} val=${val#\"} val=${val%\"} @@ -31,10 +34,10 @@ locale_warn() { done for bad in $bad_names; do for var in ${vars}; do - [ "${bad}" = "${var%\=*}" ] || continue - value=${var#*=} - [ "${bad_lcs#* ${value}}" = "${bad_lcs}" ] && - bad_lcs="${bad_lcs} ${value}" + [ "${bad}" = "${var%=*}" ] || continue + val=${var#*=} + [ "${bad_lcs#* ${val}}" = "${bad_lcs}" ] && + bad_lcs="${bad_lcs} ${val}" break done done diff --git a/tools/run-pep8 b/tools/run-pep8 index ad55d420..20e594bc 100755 --- a/tools/run-pep8 +++ b/tools/run-pep8 @@ -21,10 +21,22 @@ else base=`pwd`/tools/ fi +IGNORE="E501" # Line too long (these are caught by pylint) + +# King Arthur: Be quiet! ... Be Quiet! I Order You to Be Quiet. +IGNORE="$IGNORE,E121" # Continuation line indentation is not a multiple of four +IGNORE="$IGNORE,E123" # Closing bracket does not match indentation of opening bracket's line +IGNORE="$IGNORE,E124" # Closing bracket missing visual indentation +IGNORE="$IGNORE,E125" # Continuation line does not distinguish itself from next logical line +IGNORE="$IGNORE,E126" # Continuation line over-indented for hanging indent +IGNORE="$IGNORE,E127" # Continuation line over-indented for visual indent +IGNORE="$IGNORE,E128" # Continuation line under-indented for visual indent +IGNORE="$IGNORE,E502" # The backslash is redundant between brackets + cmd=( ${base}/hacking.py - --ignore=E501 # Line too long (these are caught by pylint) + --ignore="$IGNORE" "${files[@]}" ) diff --git a/tools/validate-yaml.py b/tools/validate-yaml.py new file mode 100755 index 00000000..eda59cb8 --- /dev/null +++ b/tools/validate-yaml.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python + +"""Try to read a YAML file and report any errors. +""" + +import sys + +import yaml + + +if __name__ == "__main__": + bads = 0 + for fn in sys.argv[1:]: + sys.stdout.write("%s" % (fn)) + try: + fh = open(fn, 'r') + yaml.safe_load(fh.read()) + fh.close() + sys.stdout.write(" - ok\n") + except Exception, e: + sys.stdout.write(" - bad (%s)\n" % (e)) + bads += 1 + if bads > 0: + sys.exit(1) + else: + sys.exit(0) |