#!/bin/sh
# run static code checks like pyflakes and pep8
set -e

#
# pyflakes
#

pyflakes pkg/docker/cockpit-atomic-storage

# TODO: there are currently a lot of pyflakes errors like
#   'parent' imported but unused
#   'from testlib import *' used; unable to detect undefined names
# Filter these out until these get fixed properly.
out=$(pyflakes test/ test/verify/check-* 2>&1 | grep -Ev "(unable to detect undefined names|defined from star imports|'parent' imported but unused)") || true
if [ -n "$out" ]; then
    echo "ERROR: pyflakes"
    echo "$out"
    exit 1
fi
