lisp-critic
2024-10-12
LISP-CRITIC - A Lisp code critiquing package.
Upstream URL
Author
Maintainer
License
1LISP-CRITIC - A Lisp code critiquing package.
see https://courses.cs.northwestern.edu/325/exercises/critic.php#critic
- Author: Chris Riesbeck
- Licence: MIT Licence
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")