#!/bin/bash

# Python style checks.
. `dirname -- ${BASH_SOURCE[0]}`/common_functions.sh
setup_trap
cd_top

# Check Python coding standards: check for tab characters.
# Ignore generated files.
grep -E '	' `git ls-files -- '*.py'` |
    sed -e 's/:.*//' \
    -e '/swig_wiredtiger.py/d' \
    -e '/\/wiredtiger.py/d' \
    -e '/src\/docs\/tools\/doxypy.py/d' |
    sort -u |
    sed 's/^/	/' > $t
test -s $t && {
    echo '[tab] characters appear in Python scripts:'
    cat $t
}
# Check Python coding standards: check for uncommented trailing semi-colons.
# Don't check too widely, there are third-party tools that fail this test as
# well as scripts in this directory that output C code, and so fail the test.
grep -E '^[^#]*;$' `find lang test -name '*.py'`> $t
test -s $t && {
    echo 'trailing semi-colons in selected Python code:'
    cat $t
}

exit 0
