The static code analyzer

Yacas has some tools to assess the quality of the scripts. The code checking tools are never finished, as new bugs are found, and guards against them added.

The idea behind the static code checkers is to check that coding standards are upheld, and to mark code that is dangerous and thus is likely to be buggy.

The following sections each describe one specific type of test. The static code analysis code can be found in codecheck.rep .


Interface check

As described in an essay elsewhere, files should be careful with what they expose to the environment. the def file mechanism and the LocalSymbols routine should be used for this. The interface check verifies that no global resources are accidentally

The rules that should be upheld are:

The interface check also assumes the code to consist of simple function definitions. It is meant to be used for the scripts in the standard scripts library. Exposing functionality to the outside world is usually less of a problem in one-off scripts to do specific calculations, for instance.


General rules

The following rules are general guide lines.


Transformation rule checks


Coverage checks

Next to checking if functions are declared in the associated def file, the analyzer could also detect if: