On Mon, Dec 19, 2005 at 11:59:11AM -0800, C Y wrote: > There exists in the CMU Artificial Intelligence Repository the > beginnings of a lint like tool for lisp. > > http://www-cgi.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/tools/lint/0.html > > lint is a tool intended to find common errors in source code, and be > somewhat more helpful (or strict, as the case may be) than compilers > themselves are. I've often thought it would be useful to have a tool > that could read source code and spot common implementation mistakes > made by new programmers - it might save some wear on the comp.lang.lisp > experts. Of course, it would need those experts to program it, but > once done... :-) > > Just a thought.
Chris Riesbeck wrote the Lisp Critic for this purpose. A version with an ASDF file is available here: http://www.xach.com/lisp/lisp-critic.tar.gz Example input and output: (critique (defun count-a (lst) (setq n 0) (dolist (x lst) (if (equal x 'a) (setq n (+ n 1)))) n)) Example output: ---------------------------------------------------------------------- SETS-GLOBALS: GLOBALS!! Don't use global variables, i.e., N N ---------------------------------------------------------------------- DOLIST-SETF: Don't use SETQ inside DOLIST to accumulate values for N. Use DO. Make N a DO variable and don't use SETQ etc at all. ---------------------------------------------------------------------- USE-EQL: Unless something special is going on, use EQL, not EQUAL. ---------------------------------------------------------------------- X-PLUS-1: Don't use (+ N 1), use (1+ N) for its value or (INCF N) to change N, whichever is appropriate here. ---------------------------------------------------------------------- Zach _______________________________________________ Gardeners mailing list Gardeners@lispniks.com http://www.lispniks.com/mailman/listinfo/gardeners