This many years later, has anyone written a code analysis tool that
would report back such valuable information in the UniVerse/MV space?
I have seen the usual (albeit dated) pre-compilers, etc. but they
don’t seem to go this deep. Lately, we have had a slew of errors occur
in the field due to complex code snags, variables assigned within a
conditional statement but re-used elsewhere (#1 ill) and others of its
kind. All of these in Universe end in a program debug/break. When you
use a browser as the front end that, of course, ends the conversation
rather badly.
Our choices seem to be compile the code with an option so that debugs
do not occur (and, thus, suffer the consequences of where the newly
assigned null variable takes you) OR keep flogging the programming/QA
staff until they find every permutation of logic path. It seems a code
analysis tool ala NuMega would be welcome. They were not to warm to
the idea of adding support for UniBasic so I wondered if others have
made their own versions or know if such tools exist for our platform.
thanks
I know this isn't exactly what you want, but I've been able to use the
BSYM file in classic Pick to detect unassigned variables and easy
errors like that.
We could definitely use a more verbose compiler option.
Anyone, please correct me if I'm wrong!
Bruce H
I work with Unidata, not Universe, so this may not apply exactly to
your situation, but I imagine that there would be a similar feature in
Universe. In Unidata, compiling with the -X option produces a
variable cross-reference that really shows a lot of detail about the
variables in your program. You can see variables that were never
assigned a value, but used anyway, or the opposite, variables assigned
a value but never used otherwise. It also includes line numbers in
the source code where each variable is used, assigned, etc. In
Unidata, there's also a "TO {filename}" option you can use to keep the
cross-reference files out of your source files.
At a minimum, I'd require your developers to take a look at the xref
file before putting a program up for production, but you could also
write an automated analysis tool that looked for common errors.
There isn't enough info in the files to do any analysis of the logic
flow, so it won't help with the case you mentioned where the
assignment was in an IF statement that didn't get executed, then the
variable was referenced later anyway.