In the course of developing TclTutor I've collected a bunch of scripts with various errors that I use to validate changes I make to the code that parses the tclsh error output. It occurred to me that this set of bad code could be useful for characterizing the behavior of the static Tcl code correctness packages that have recently been developed. It then occurred to me that someone else might find this useful.
The bad code snippets I've used are *not* designed to actually put the code validation suites through their paces. Many of these code snippets have several errors, ranging from deliberate errors placed to test the parsers to random typo's that broke things in unexpected ways. I won't claim that this is anything close to an exhaustive test suite, or that it's not biased in some manner.
I'd like to thank the folks who have written these static code checkers. Tcl is an extremely difficult language for static checking, and the level of success that these packages attain is impressive.
This suite is available to developers who would like to use it to test their package, and I'll be happy to update this page when new packages become available.
Also a quick thanks to Wayne Christopher at ICEM for his encouragement in my presenting this data. ICEM was the first to request a copy of the suite to test their package.
Package | Errors | No Error | Error |
---|---|---|---|
Identified | Detected | Misidentified | |
tclsh | 15 | 0 | 2 |
tclcheck | 8 | 9 | 0 |
tcl_lint | 8 | 4 | 5 |
tclparse | 6 | 1 | 10* |
tclparse 3.0 | 13 | 1 | 3 |
tcl_cruncher | 6 | 9 | 2 |
*TclParse sometimes identified a real error after the error which caused the failure. Since the execution halting error was missed, I counted this as a misdiagnosis.
Test | Description | tclsh | tcllint | tclparse | tclparse 3.0 | tclcheck | tcl_cruncher |
---|---|---|---|---|---|---|---|
0 | Missing Quote | Fail | Fail | Fail | OK | OK | Fail |
1 | Bad Command | OK | No Error | Fail | OK | No Error | No Error |
2 | Wrong Number Args | OK | Fail | Fail | Fail | No Error | No Error |
3 | Undefined Proc | OK | Fail | OK | OK | No Error | No Error |
4 | Undefined Proc | OK | No Error | OK | OK | No Error | No Error |
5 | Bad var to incr in proc | OK | No Error | Fail | No Error | No Error | No Error |
6 | Bad var to expr | OK | OK | Fail | OK | No Error | No Error |
7 | Bad var to expr in proc | OK | OK | OK | OK | No Error | No Error |
8 | Bad upvar variable | OK | OK | Fail | OK | OK | OK |
9 | Bad args to open | OK | OK | OK | OK | No Error | No Error |
10 | Bad arg to array nextelement | OK | Fail | OK | OK | OK | OK |
11 | Bad cmd: for{... | OK | Fail | OK | OK | OK | Fail |
12 | Missing close brace | OK | OK | Fail | OK | OK | OK |
13 | eval bad proc | OK | No Error | Fail | Fail | No Error | No Error |
14 | No Error | OK | OK | Fail | Fail | OK | OK |
15 | Missing Close Bracket | Fail | OK | Fail | OK | OK | OK |
16 | Missing Quote | OK | OK | Fail | OK | OK | OK |