Prolint

Prolint is a tool for automated source code review of Progress 4GL code. It reads one or more sourcefiles and examines it for bad programming practice
When you are interested Prolint, you are encouraged to subscribe to this group where you find the on-line tools to collaborate and discuss Prolint. There is a discussion forum, you can submit issues (for bugs and enhancement requests), you can modify the on-line documentation. So subscribe, and then don't forget to go to your subscription details to enable the e-mail notification!


Select files to lint

[procedure: prolint/core/selectfiles.w, invoked from prolint/launch/start.p]

This dialog allows to select one or more sourcefiles
to lint. You can also select one or more directories:
Prolint will automatically scan directory-contents
looking for *.p and *.w (recursing into subdirectories
as well).

editor widget:

Type a list of filenames to lint, one filename on each line.

If you are using Progress 9 GUI you can use drag/drop to throw a bunch of sourcefiles into the editor widget.

toggle-box "Clear Outputhandlers":

When on (true), then all existing results will be cleared from the Results window. Other outputhandlers will also start a new, empty output.


The Prolint Result window

[procedure: prolint/outputhandlers/logwin.w]

The Prolint Result window shows a browse widget containing all warnings from the most recent Prolint run.

When Prolint is working, the statusbar shows:

  1. sourcefile where Prolint is working on
  2. which action Prolint is currently doing
  3. total number of warnings
  4. the name of the current profile
  5. percentage done, if more than one file is to be processed

When Prolint is ready, the statusbar shows:

  1. total elapsed time of last Prolint run
  2. empty
  3. total number of warnings, or if a filter is set: visible warnings / total warnings
  4. the name of the current profile
  5. empty, or "filtered" when a filter is set

Window features:


Prolint Desktop

The Prolint Desktop is simply a window with a couple of buttons on it, to launch several Prolint features from.
It is not exactly state of the art but comfortable.

It is especially comfortable when the Desktop is added to the PRO*Tools palette. There is a button near the bottom of the Prolint Desktop, labelled "Add to protools". Just press it and restart the PRO*Tools palette.
The button becomes invisible if there is already a program-name matching "*prolint*desktop*" in protools.dat.


the GUI manual

Some help for the GUI screens


file exclude.lst

# this file specifies which particular warnings should be excluded. The rules will
# still be executed, but warnings are intercepted if they match this file.
# You can also consider using {&_proparse_ prolint-nowarn(ruleid,ruleid)} directives
# 
# format:
#    sourcefile|rules
#
# sourcefile : spell exactly as it appears in "Prolint result window",
#              wildcards are accepted. CAN-DO rules apply
# rule       : comma separated list of identifiers of the rules that gives the warning, 
#              wildcards are accepted. CAN-DO rules apply
#
# empty lines or lines matching #* are ignored

Run Prolint for the first time

When you have installed proparse and prolint you are ready to run Prolint for the first time.


Let's take the quick tour:

run the following statement from a Progress procedure editor:

     RUN prolint/desktop.w.

In the Prolint Desktop, choose button "Lint files...".

You will now see a dialog, titled "Prolint - select files to lint".

This dialog contains an editor widget where you can enter a list of sourcefiles that will be processed by Prolint. Each filename should be entered on a new line, wildcards are currently not supported.
The easiest way to populate the list is by using drag and drop: open a Windows Explorer, select one or more
Progress sourcefiles and drag/drop them into the dialog.


Settings and Profiles

for a GUI-window to modify the settings described here:

   run prolint/core/lintcfg.w("")                               

Directory prolint/settings shows an example of how custom profiles can be used.

Each profile represents a subdirectory in prolint/settings.

Such a subdirectory may contain configuration files describing the behavior of Prolint.

The name of the custom profile is passed to Prolint as an input parameter. For example:

  RUN prolint/core/prolint.p (sourcefile, ttemptablehandle, "relaxed", true).

tells prolint to look for configuration files in directory prolint/settings/relaxed.


Regression testing

When you add of change something to any Prolint source, you can do a regression test to see if you broke something.


Profiles

You don't always want to run every rule. A "profile" contains a specification of the rules you want to skip and which outputhandlers you want to use. You can create as many profiles as you want.

For example, you may want to create a profile named "indexes" that only uses rules "nowhere", "sortaccess" and "wholeindex" and writes its output to HTML and to a tab-delimited file. Or you may want to ue profile "Ed4Win" that writes its output to the build-window in ED for Windows.

Each subdirectory in "prolint/settings" is a profile. Each of those subdirectories contains a couple of ascii-files to define the characteristics of the profile.

Local profiles vs Shared profiles

Profiles in "prolint/settings" are considered to be "shared" profiles.


Configuration

This chapter will explain the various configuration options for Prolint


What is Prolint

Prolint is a tool for automated source code review of Progress 4GL code. It reads one or more sourcefiles and examines it
for bad programming practices or violations against coding standards.

Prolint does not change or rewrite source code, it is no beauty.p.

Rules

Prolint works with a customizable library of "rules".
A "rule" is a specific test that Prolint can perform on source code. Some examples:

  • every variable should be defined NO-UNDO.
  • variables that aren't accessed should be removed from the source

How to create a new outputhandler

An outputhandler must be located in directory prolint/outputhandlers, and has to be listed in
file prolint/outputhandlers/choices.d.


Columns in file prolint/outputhandlers/choices.d:

  1. programname.
  2. minimum required Progress version (integer).

    only the main version, like 8 or 9, is supposed to be listed here.

    The outputhandler will not be run if this value is less than the current Progress version

  3. supported window-system.

    possible values:

    "GUI" this outputhandler will only run in a GUI session
    "TTY" this outputhandler will only run in a ChUI session
    "*" this outputhandler will run in any window-mode
    "" this outputhandler will only run in batch-mode
  4. short description (only one line)

Each outputhandler is loaded persistently by prolint.p, but prolint will never delete the procedure. The outputhandler has to delete itself when ready,
usually from within the event-procedure for event "Prolint_FinalizeResults".

The outputhandler subscribes to, and responds to (some) of the following published events:


PROCEDURE Prolint_InitializeResults :  
   DEFINE INPUT PARAMETER pClearOutput AS LOGICAL NO-UNDO.
END PROCEDURE.              

Event Prolint_InitializeResults is published when prolint.p starts.


Prolint Source Overview

All tests are performed by "rules", these are programs in directory prolint/rules.
This is where the actual knowledge about Progress source code review is implemented.


Extract adecomm.pl

Unless you are running Progress version 8 or TTY mode, you will need to extract adecomm.pl.

This is because the codepreview window contains an editor, which uses the same syntax-coloring editor as the Progress Appbuilder, and adecomm.pl contains the includefiles that makes this possible.

Instructions

Open a command shell and change directory to your DLC directory. In the following example I will assume this is directory "c:\Program Files\Progress" :


cd \progra~1\progress\gui

set DLC=c:\progra~1\progress

Installation

The pages in this chapter will guide you through the installation of Prolint.


# Syndicate content