#!/bin/bash -e
flake8 .

cd examples
GIT_ARG="--git-dir ../.git --work-tree .."

# find out modified python files, so that we ignored unstaged files
# exclude ../docs
MOD=$(git $GIT_ARG status -s | grep -E '\.py$'  \
	| grep -E '^\b+M\b+' | cut -c 4- | grep -v '../docs')
if [[ -n $MOD ]]; then
	flake8 $MOD
fi
