Good tools for tidy and lint newlisp code

Featuring the Dragonfly web framework
Locked
ssqq
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

Good tools for tidy and lint newlisp code

Post by ssqq »

I re-design these two tools now:

tidy newlisp:
could find loss ")" or more ")". while, letn, dotimes all indent two space.

https://github.com/songzan/newlisp-spp/ ... s/lint.lsp

usage: > newlisp tidy.lsp target.lsp

lint nelisp:
could check un-declare symbol and un-used symbol.

https://github.com/songzan/newlisp-spp/ ... s/lint.lsp

usage: newlisp lint.lsp target.lsp

or you could puts them in your bin path:

Code: Select all

newlisp -x lint.lsp lint
chmod 755 lint
sudo mv lint /usr/bin/lint
newlisp -x tidy.lsp tidy
chmod 755 tidy
sudo mv tidy /usr/bin/tidy
Last edited by ssqq on Sat Jul 30, 2016 7:17 am, edited 1 time in total.

ssqq
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

Re: Good tools for tidy and lint newlisp code

Post by ssqq »

When we use newlisp write code, the interpreter could not do anything for us. Because newLISP must be rapidly, more and more.

So, we could do something for to more stable code:

1. un-used symbol:

Code: Select all

(define (foo x y) (+ x 1))
below code, symbol 'y' have not used, It's may not any dangrous. but:

Code: Select all

(define (foo x) (+ x y))
If we use an un-declare symbol, may be occure some accident.

If we could not find below error, may enlarge error:

Code: Select all

(define (foo x) (set 'y 10) (+ x y))
Now, all function in current Context would see this symbol, if you use this symbol, the value
may not be control by you.

all of it could not be find by newLISP interpreter, but Lint.lsp could do it.

> newlisp lint.lsp target.lsp
or you could compiler it in first.
> lint target.lsp

Locked