running Prolint

run prolint

run prolint/core/prolint.p(...) analyzes one or more sourcefiles, it is the entrypoint of all parsing.
Because prolint.p requires a couple of input parameters you will probably prefer to run a "wrapper"-procedure that first assigns those parameters and then passes them to prolint.p.


Let's first look at an example "wrapper", the parameters are explained later in this page.

"wrapper"-procedures

procedure prolint/launch/start.p is an example of a "wrapper", it first runs a dialog where you can choose values for all parameters and then it calls prolint.p.

start.p should work in Progress 9 and OpenEdge 10, GUI or ChUI (and Progress 8 if you have Prolint release 63)

Here is a simple example with no user interface: it scans the contents of directory "d:\myproject" and runs prolint

DEFINE VARIABLE fname    AS CHARACTER NO-UNDO.
DEFINE VARIABLE fullpath AS CHARACTER NO-UNDO.
DEFINE VARIABLE attribs  AS CHARACTER NO-UNDO.
                                                 
DEFINE TEMP-TABLE tt_files NO-UNDO
   FIELD SourceFile AS CHARACTER.
            
/* find all sourcefiles in directory */
INPUT FROM OS-DIR ("d:\myproject").
 REPEAT:
   IMPORT fname fullpath attribs.
   IF NOT (attribs MATCHES "*D*") THEN 
      IF (fname MATCHES "*~~.p") OR (fname MATCHES "*~~.w") THEN DO:
          CREATE tt_files.
          ASSIGN tt_files.SourceFile = fullpath.
      END.
 END.        
INPUT CLOSE.   
                                       
/* now lint all of them, send output to prolint.log (=profile "batchrun") */
IF CAN-FIND(FIRST tt_files) THEN 
   RUN prolint/core/prolint.p ("",
                          THIS-PROCEDURE:HANDLE,
                          "batchrun",
                          TRUE).    

/* You could simply pass the temp-table handle, but 
 * that doesn't work in Progress version 8:
 *
 * IF CAN-FIND(FIRST tt_files) THEN 
 *    RUN prolint/core/prolint.p ("",
 *                           TEMP-TABLE tt_files:HANDLE,
 *                           "batchrun",
 *                           TRUE).    
 */
                       
RETURN.
PROCEDURE GetFirstLintSource :
  /* purpose: prolint.p calls this ip to ask for the first sourcefile to analyze.
              return ? if you don't have any sourcefiles. */
  DEFINE OUTPUT PARAMETER pSourceFile AS CHARACTER NO-UNDO.
  
  FIND FIRST tt_sourcefiles NO-ERROR.
  IF AVAILABLE tt_sourcefiles THEN 
     pSourceFile = tt_sourcefiles.SourceFile.
  ELSE 
     pSourceFile = ?.
  
END PROCEDURE.
PROCEDURE GetNextLintSource :
  /* purpose: prolint.p calls this ip to ask for the next sourcefile to analyze.
              return ? to stop */
  DEFINE OUTPUT PARAMETER pSourceFile AS CHARACTER NO-UNDO.
  
  FIND NEXT tt_sourcefiles NO-ERROR.
  IF AVAILABLE tt_sourcefiles THEN 
     pSourceFile = tt_sourcefiles.SourceFile.
  ELSE 
     pSourceFile = ?.
  
END PROCEDURE.

Note that the above example is just an example, an easier way to get almost the same result is:

   RUN prolint/core/prolint.p ("d:\myproject",
                          ?,
                          "batchrun",
                          TRUE).    

Two differences with the first example:
1. Prolint will scan directory d:\myproject and all its subdirectories
2. Prolint will not only look for .p and .w extensions, but all extensions specified in prolint.properties.p

parameters for prolint/prolint.p:

input pSourcefile (as character)

The filename of a sourcefile you want to lint. This parameter is convenient if you want to lint just one single sourcefile.
If you want to lint multiple sourcefiles it is recommended to set SourceFile="" and use hSourcefileList instead.

pSourcefile can also specify a directory. In that case Prolint will search every compilation-unit in that directory and all its subdirectories recursive. Compilation-units are recognized by file extension; the list of file extensions is "*.p,*.pp,*.w,*.cls" by default but you can change this using the prolint.properties.p file.

pSourcefile can also specify a comma-separated list of sourcefiles and/or directories.

input hSourcefileList (as handle)

The handle to a procedure or to a temp-table, or the unknown value. Set this parameter if you want prolint to analyze multiple sourcefiles in a single run.


If it is a PROCEDURE:HANDLE, prolint requires that this procedure contains two internal procedures: procedure GetFirstLintSource(output pSourceFile) and procedure GetNextLintSource(output pSourceFile). Prolint runs these internal procedures in hSourcefileList until one of them returns the unknown value.


If it is a TEMP-TABLE:HANDLE, then prolint assumes this temp-table contains one or more records, where each record contains the name of one sourcefile in a field with fieldname="SourceFile".

input pCustomProfile (as character)

The name of a profile, specifying which rules and outputhandlers to run.

input pClearOutput (as logical)

Specifies if you want to append warnings from Prolint to existing output, or replace existing output by new output.

if pClearOutput=TRUE, the outputhandlers will overwrite existing output.

if pClearOutput=FALSE, the outputhandlers will append to existing output.