Dynamic Language Lint

"Lint" is a utility that warns about potential problems with C code. In a lot of the HolyWars between dynamic and static typing, it is often assumed that only during run-time will anything be found wrong with a dynamic language program.

However, I don't see why there could not be a Lint-like utility for dynamic languages. It could do basic parsing to make sure there are no missing parenthesis, semi-colons, etc. It could also flag/point-out suspicious usages, such as using the same variable to be assigned a string constant one place and a numeric one in another. Ideally one could tell it what specific issues to ignore for a given code block so that the output does not get cluttered up for later checks.

(But there is nothing wrong with a variable holding both string and numeric constants. See DeclarativeGuiLanguage for an example.)

            // get requested international language library
            target_lang = config.getTargetLanguage();
            target_file = "langs/" . target_lang . "/vocab.prg";  // language file path
            loadLibrary(target_file);

I've written a Lint-like utility for BbcBasic. As I say on that page, we use it it full-blown commercial systems and the tool means that there are no nasty syntax surprises. It also allows variable declaration and expected usage by adding special REM statements, and deals with loading libraries. BBC BASIC V is a dynamic language, albeit limited, so I don't see what the problem would be. It's certainly been very useful for us.

There's also PyChecker, basically a lint for python. And PyLint?, which allegedly does everything PyChecker does plus more stuff.

Perl also has the -w option, which complains about some common problems in perl programs before actually running them. It als has the strict directive.

Ruby also has -w, and actually it has 3 warning levels: silence,medium,verbose(default)

Alternately, you could just write a lexx/yacc(i.e. flex/bison) parser that will apply whatever rules you want, for whatever language you assign it.

Such will only catch syntax errors, not necessarily undefined references, etc.


Things it could potentially warn about include but are not limited to:


CategoryLint, CategoryScripting


EditText of this page (last edited February 2, 2012) or FindPage with title or text search