Summary editTclChecker is a fork of procheck, the static analysis tool that is included with Tcl Dev Kit
- official reference ,version 5.3
Description editTclChecker covers the extended commands of Tcl 8.4 and 8.5, fixes bugs in the checking for other versions, adds checks for new possible errors, and was also integrated with tcldebugger and the Komodo IDE.
Additional .pcx files for Tcl extensions editLV: So, has anyone created the necessary .pcx files to allow tclchecker to check the more common tcl extensions? TDK comes with some documentation on creating these files. However, they are relatively complex. It would be useful to try and take the info from the doc and try to write a usable .pcx file, just to work out the kinks of how things work. It seems pretty complex.AK: I have .pcx files for some of the packages in Tcllib. I will commit them (incrementally) to Tcllib. They will require version 4.1 of Tcl Dev Kit. Musings (a kind of review)
PL: I tried TclChecker on some of my longer programs today (2014-01-11). I'm not quite sure how I feel about it. TC didn't find very much to complain about, which I suppose could be because I'm just that good -- OTOH, it could mean that TC fails to detect anything beyond the most obvious blunders. So, what did it find?
- I sometimes omit the default clause in a switch command. Yikes.
- I sometimes omit -- before the string argument in a switch command. Oops. (TC did not complain about me omitting the -- in a regexp command, however, even when I used a variable dereference for the exp value.)
- I tend to omit the optional level argument to upvar.
- I occasionally use constructs like set $varName foo or variable $varName foo, for instance when initializing a bunch of variables in one action, or append $varName foo if I need to select which variable to append to. TC doesn't like any of these, but is satisfied when I change $varName to [set varName] (which does make sense, since that's a lot less likely to be a mistake). It does recognize and accept the idiom upvar 1 $varName myVar.
- A lot of undefined variables that actually were defined: TC got confused in a couple of cases when variables were being set using regexp (there was some indirection involved) or using dict with. (TC is a static analysis tool after all, so I don't really blame it for not figuring it out here.)
- I tend to omit the braces around the condition in an if command if all of the condition is a variable dereference, a command invocation, or a boolean literal such as no or 0 (mostly used when excluding sections of code "Bauersachs braces"-style). TC gets concerned about "avoid[ing] double substitution and/or performance degradation".