Next: , Previous: , Up: SEL Coding Standards   [Contents][Index]


D.2 Formatting

All code should conform to the following standards:

Google’s Common Lisp guide is generally applicable. Specifically the sections on Formatting and Comment semicolons.

The lisp-format utility may be used to automatically check and fix code formatting. See the comments at the top of the lisp-format script for more information. The git-lisp-format script (adopted from git-clang-format) integrates lisp-format with git, enabling the easy application of lisp-format to all lines that differ between the working directory and a given commit, which defaults to HEAD. To automatically run “git lisp-format” before every commit and abort the commit when re-formatting is needed, save the following shell script to .git/hooks/pre-commit in the base of this repository and mark it as executable.

#!/bin/bash
OUTPUT=$(git lisp-format --diff)
if [ "${OUTPUT}" == "no modified files to format" ] ||
   [ "${OUTPUT}" == "lisp-format did not modify any files" ];then
    exit 0
else
    echo "Run git lisp-format, then commit."
    exit 1
fi