procheck(1)

NAME
procheck - TclPro Checker

SYNOPSIS
procheck ?options? ?filePattern ...?

OPTIONS

-help
    Displays usage information, then exit without doing anything.

-nologo
    Hides the copyright and version information.

-quiet
    Outputs the basic error information contained on one line, as opposed to the three line output that includes the code body and the error indicator.

-verbose
    Displays version information and summary information when the checker exits.

-suppress messageID
    Suppress one or more messageIDs from being printed. The messageID argument can be a single messageID or a quoted string of messageIDs separated by spaces.

-use checkerPackage?version?
    Specifies the packages and versions to use for checking the script. If the checkerPackage argument is append with version, then that version of the system is used to check the scripts, otherwise the default version is used. The checkerPackage?version? argument can be a single package or a quoted list separated by spaces. If the same checker package is specified on the command line more than once, the last version specified is used. See the section CHECKER PACKAGES for more information.

-W1 Display parsing errors and syntax errors.

-W2 Display parsing errors, syntax errors, and usage warnings.

-W3 Display parsing errors, syntax errors, usage warnings, portability warnings, upgrade warnings and performance warnings.

-Wall
    Same as the -W3 option for this version, but is guaranteed to always print all of the messages in future releases. This is the default.

DESCRIPTION

The command procheck is used to run TclPro Checker on files that match the filePattern command line arguments. If no file pattern is specified, TclPro Checker will use stdin as input. TclPro Checker is designed to help find syntax errors and other common usage errors in Tcl scripts quickly, without having to run the program. TclPro Checker will also warn about potential incompatibilities to help upgrade applications to the latest releases of Tcl, Tk and [incr Tcl]. The list of valid package names and versions are:

    tcl 7.3, 7.4, 7.5, 7.6, 8.0, 8.1 and 8.2 (default)

    tk  3.6, 4.0, 4.1, 4.2, 8.0, 8.1 and 8.2 (default)

    incrTcl
        1.5, 2.0, 2.1, 2.2, 3.0 and 3.1 (default)

    expect
        5.28, 5.29, 5.30 and 5.31 (default)

    tclX
        8.0, 8.1 and 8.2 (default)

Every message printed has a messageID associated with it. The messageID is the word in parenthesis just after the file and line number information. The messageID can be used with the -suppress option to prevent that type of message from being printed. For example, the following warning message is reported for any Tcl command that is not available on all platforms. The messageID is nonPortCmd, and can be suppressed by specifying -suppress nonPortCmd on the command line.

foo.tcl:53 (nonPortCmd) use of non-portable command registry values $key ^

TclPro Checker prints the following categories of errors and warnings:

    parsing errors
        Commands that can not be parsed by the Tcl parser generate an error. The reason for the parsing error and the location of the offending character are reported. TclPro Checker will attempt to skip ahead and continue to check additional commands after the parsing error.

    syntax errors
        Any commands that will fail because of wrong number of arguments, invalid types, invalid options, etc. are reported. Only commands defined in Tcl, Tk or [incr Tcl] are checked for syntax errors.

    platform portability warnings
        TclPro Checker generates warnings when a command is used that may be non-portable between various platforms.

    suggestions for upgrading
        Upgrade warnings indicate any feature that will change in a later version.

    performance warnings
        A warning is generated when a performance optimization opportunity is detected.

    usage warnings
        A warning is generated when a command appears to have an error, but is perfectly legal syntax. For example "incr $counter" will generate a warning because the incr command expects a variable name, not a value. This command is probably an error, although it is possible the variable counter may contain a variable name.

CHECKER PACKAGES

If the -use switch is not specified default versions Tcl, Tk, [incr Tcl], Expect and TclX (listed above) are automatically loaded to check the Tcl scripts. If the -use switch is specified, then Tcl is the only package implicitly loaded, and other packages must be specified on the command line. The following example will check the script against Tcl, Tk and all of the supported extensions ([incrTcl], Expect and TclX.)

procheck foo.tcl

The next example will only check the script against the latest version of Tcl and Tk.

procheck -use tk foo.tcl

TclPro Checker attempts to load compatible versions of Tcl, Tk and the supported extensions. If no versions are specified, the default version is assumend. When a version is requested for a package, the remaining packages will be loaded with compatable versions. If incompatable versions are specified, an error is generated and procheck exits. For example, the following command will load Tcl7.5 and Tk4.1 based on the request for [incr Tcl] version 2.1.

procheck -use tk -use incrTcl2.1 foo.tcl

However the next example will generate an error and exit because the versions for Tcl and Tk are incompatable.

procheck -use tk3.6 -use tcl8.0 foo.tcl

EXAMPLE

The following example shows how to check Tcl 7.5 and Tk 3.6, showing parsing errors, syntax errors, upgrade warnings and performance warnings. Usage and portability warnings will not be reported.

procheck -use tcl7.5 -use tk3.6 -W2 -s nonPortable foo.tcl TclPro Checker -- Copyright Scriptics, Corp. 1998 foo.tcl foo.tcl:162 (nonLiteralExpr) expression is not a literal value expr [string length $literal]-1
     ^ foo.tcl:180 (parse) parse error: missing close-brace proc checkWord {tokens index} {
                        ^ foo.tcl:281 (numArgs) wrong # args for {set i 0} {$i < ^

KEYWORDS
messageID