lisp-critic

2023-10-21

LISP-CRITIC - A Lisp code critiquing package.

Upstream URL

github.com/g000001/lisp-critic

Author

Chris Riesbeck

Maintainer

CHIBA Masaomi

License

MIT License, MIT Licence
README

1LISP-CRITIC - A Lisp code critiquing package.

see https://courses.cs.northwestern.edu/325/exercises/critic.php#critic

  • Author: Chris Riesbeck
  • Licence: MIT Licence
Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the "Software"),to deal in the Software without restriction, including without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, and to permit persons to whom theSoftware is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Load:

(asdf:load-system :lisp-critic)
Example call:
 (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.
----------------------------------------------------------------------

See the lisp-critic.lisp file for more information. To load LISP-CRITIC to the REPL, Type (USE-PACKAGE :LISP-CRITIC).

To run the Lisp Critic on an entire file of code:

(critique-file pathname)

For example,

(critique-file "~/riesbeck/cs325/chap9-exs.lisp")

Dependencies (0)

    Dependents (0)

      • GitHub
      • Quicklisp