blob: 44146566f85c7aa19a3526f42c3451f62fcf9f5e [file] [log] [blame]
#!/bin/sh
# NOTE: Run this script from the root of the ViewVC checkout.
#
# $ ./tools/check-code-formatting
# The linting tools will generally find all the .py files, but we want
# to also add into the set of checked paths other Python files
# (scripts that reference Python in the shebang line, WSGI stubs,
# etc.)
echo "Checking code formatting..."
PYFILES=`grep -rl '^#\(!.*/\|.*-\)python' --exclude=*.py .`
black --line-length=100 --quiet --check . ${PYFILES} && flake8 . ${PYFILES}
echo ""
if [ $? -eq 0 ]; then
echo "Linting succeeded!"
else
echo "Linting failed."
echo "Try running 'black --line-length=100' on your problematic files."
fi