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;

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

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

        if [[ $? != 0 ]]; then
            ret_code=1
        fi
    fi
done

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)



lapwing-web.download; 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 …