running flake8 in git’s pre-commit

I’m forever forgetting to remove debug statements or to run flake8 on my source code. Not to panic though, git hooks to the rescue!

You can just put pre-commit into $PROJECT_DIR/.git/hooks, chmod +x it and be away.

This is the useful part of the file;

for file in $(git diff --name-only --cached $against); do
    if [[ -n "$(grep 'DEBUGS' $file)" ]]; then
        echo "DEBUGS in file $file"

    if [[ "${file##*.}" == "py" ]]; then
        flake8 $file

        if [[ $? != 0 ]]; then

exit $ret_code

$against is the commit to check against (taken from the pre-commit.sample file).

DEBUGS is the comment tag I use to denote debug statements, which is used by geany in the Task addons plugin to list any occurrences of it in the file (along with TODO and FIXME comments); mockups

I’ve been working on some mockups for lapwing-web download application.

These are some SVG mockups made using Inkscape and JessyInk. JessyInk turns SVG files into mini presentations, in this case I’ve used the effects to fade in the comments about some design decisions.

These aren’t particularly high …