I want to add a static code checker as a pre-commit hook on my Emacs-Lisp code, mainly for catching errors such as Symbol’s function definition is void.
Static code analysis tool for Common Lisp? suggests lisp-critic (original and remake). It uses ASDF (Another System Definition Facility), which I'd need to install on my machine, and wrap the call to lisp-critic in a bash script in .git/hooks/pre-commit as in Git: Prevent commits in master branch.
The documentation for lisp-critic uses inline code:
(critique
(defun count-a (lst)
(setq n 0)
(dolist (x lst)
(if (equal x 'a)
(setq n (+ n 1))))
n))
and I'm not sure if the package analyzes code defined in a separate file. And I also don't know if lisp-critic is compatible with Emacs-LISP.
Has anyone set up a similar system who can give me some pointers?