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!


file nowarn.lst

# this file specifies which particular warnings should be suppressed. 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|rule|linenumbers
#    sourcefile|_file-size|size
#
# sourcefile : spell exactly as it appears in "Prolint result window"
# rule       : identifier of the rule that gives the warning
# linenumbers: comma separated list of linenumbers where the warning would occur when not suppressed
#
# size : the filesize of the sourcefile, in bytes

Turbolint

Note: This is history. Turbolint is removed from Prolint release 74, because Turbolint was not compatible with Proparse.NET


Suppress warnings

Sometimes Prolint may raise a warning you don't agree with.
For example, rule "noundo" might warn that a specific temp-table is defined without NO-UNDO while you are certain that not using no-undo
is intentional.


In such cases you may want to suppress the Prolint warning.


There are two separate ways to suppress warnings:

  1. mark the statement with a _proparse_ directive
  2. use filters

Finally, if you really completely disagree with a rule, you can put it in the "skiprules" list. In that case Prolint will pretend the rule does not exist at all. The "skiprules" list is file "prolint/custom/rules/skiprules.lst". Its format is simple: each line contains one rule-id.

_proparse_ directives

Let's begin with an example:

{&_proparse_ prolint-nowarn(noundo)}
DEFINE TEMP-TABLE tt_mytable 
   FIELD code AS CHAR
   FIELD desc AS CHAR INIT "<description>"
   INDEX idx_code AS PRIMARY UNIQUE code.

When Prolint executes rule "noundo" it will simply skip the statement, the statement is invisible to the rule.

Prolint will still give a warning for rule "abbrevkwd" because INIT is an abbreviation for INITIAL, and a warning for
rule "strattrib" because "<description>" does not have any string attributes.


Integrating Prolint and "ED for Windows"

Prolint integrates with "ED for Windows" in three ways:

  1. double-click in the "Prolint Results" window will open the conflicting source in "ED for Windows"
  2. while you are editing a sourcefile in "ED for Windows", you can press a custom toolbar-button to have this sourcefile inspected by Prolint.
  3. ED can import the warnings that you have filtered and sorted in the Prolint Results window.

1. double-click in Prolint Results window:

The first feature is configured in file prolint/settings/exteditor.cfg, see "settings".

2. Lint current file in ED for Windows:

The second feature requires proed4w, which is another free tool from global-shared.com. The following screen-shot shows proed4w in action:

You see a new toolbar-button (the white document with the red exclamation mark), when you press it the blue "Build results" pane will pop up and show
results from Prolint. This "Build results" pane can be used for navigating through the sourcefile, but you can also use the "previous error" and "next error" buttons.

Surf to "ProED4W" for download and general setup-instructions.

After you have installed proed4w as outlined in its general setup-instructions, you have to make one final setting in Prolint:


Configuration of Roundtable Check-in Validation

Validation is disabled by default

To enable validation, create a directory "prolint/custom/rtb-check-in" and then copy file "prolint/roundtable/version/prolint-rtb-check-in.ini" to "prolint/custom/rtb-check-in/default.ini".


The ini file contains several tuning options for the validation.

The validation will read the options in file "prolint/custom/rtb-check-in/default.ini".


Create new rules

Each rule is a non-persistent procedure located in directory prolint/rules. A rule will be invoked by prolint.p if it is listed in file prolint/rules/rules.d.

Supporting files

file prolint/rules/rules.d

An easy way to insert a new record in this file, is to run dialog
prolint/core/dnewrule.w.

This dialog can be invoked from the Prolint Desktop window.

The file contains the following fields per record:

  1. rule_id (string)

Revision history

prolint release 74, 14 march 2011:
  • Support for Proparse.NET instead of Proparse.DLL. As a result Turbolint.DLL has been removed and Prolint now requires OpenEdge 10.2B and Windows as a minimum
  • Bugfixes by Niek Knijneburg. Thanks Niek!
prolint release 73, 8 Februari 2009:
  • several bugfixes
  • new feature: community-contributed rules in directory "prolint/contribs/rules", as proposed in http://www.oehive.org/node/1150
  • removed rule nopprsininclude, because it is now in "contribs/rules"
  • if a c.u. doesn't compile then prolint will show the compiler messages, with line-numbers
  • rule "do1" may be configured to have a skiplist, that specifies which statements are allowed to appear as only statement in a DO..END block
  • added new rule "streamclose" to check if all streams are closed after use
  • rule "varusage" can be configured to skip shared variables assuming that those variables are probably used in a different c.u.
prolint release 72, 12 April 2008:
  • Added new rule andorparens to find logical expressions with a mix of AND and OR that have no parentheses
  • Fixed every open bug report that was in the issue tracker.
  • Regression tests were out of sync, now they are clean
prolint release 71, 9 march 2008:

Important: if you are upgrading to Prolint 71 and use Roundtable integration, you MUST change rtb_evnts.p to avoid errors. The change only takes a minute and is described at page Repair your Roundtable Integration

New in this release is support for Roundtable 10.1b, created by Thomas Hansen.
The old directory "prolint/rtb" is gone and replaced by a new directory "prolint/roundtable/" + version-number.

Also new are a bunch of rules created by Glen West:


Filter plug-ins

Filters let you modify or delete warnings.

Directory "prolint/filters" contains 4gl procedure files, each .p file in this directory is a filter.


Each time when any rule creates a warning, the warning will first go through each filter before it is published to each outputhandler.
A filter can modify the description or severity fields, or it can mark the warning as 'filtered' in which case the outputhandler will probably ignore the warning.

Each filter has the same API which makes it easy to add your own custom filters. You can use the filters/_template.pp file as a boilerplate for creating a new filter.


Prolint configuration window

[procedure: prolint/core/lintcfg.w, invoked from anywhere]

This dialog helps you switch rules on/off, override default severities and select outputhandlers.

See "profiles" for a general discussion about profiles.

The combo-box contains a list of profiles found in directories "prolint/settings" and "local-prolint/settings", and it also contains a profile named "<none>" which is the default profile. The settings for "<none>" are stored in directory "prolint/settings", instead of in one of its subdirectories.

When you select a profile (using the combo-box), you will see a text next to the combo-box
indicating if this profile is a shared profile or a private profile. Shared profiles are found in "prolint/settings", private profiles are found in "local-prolint/settings".


optional: the prolint database

Prolintdb consists of an outputhandler to write warnings to a database, and a couple of programs to help you query the database.

the user story:

Suppose you have a pretty large software project and want to inspect it with Prolint. It will take a long while for Prolint to finish the job,
so you would like to run Prolint unattended and look at the warnings later. Since it is a large software project Prolint will probably find
thousands of warnings, so you need tools to help you generate an overview.

Setup / configuration

  1. Create a Progress database. Do not create the database in the Prolint directory or in one of its subdirectories, because
    that might cause trouble with future updates of Prolint. I would suggest to create separate databases for each software project.

  2. Make sure the logical database name is "prolintdb".
  3. Load the dictionary from file "prolint/prolintdb/prolintdb.df".
  4. modify your startup script or shortcut, so this database will be connected in the session where you run Prolint.

Using Prolintdb

Make sure the prolintdb database is connected with logical database name "prolintdb".

Run Prolint as usual, but select a profile that uses outputhandler "prolintdb.p". This outputhandler is responsible for writing warnings to the database.
When you do not want to write anything to the database, then just don't use outputhandler "prolintdb.p".

To query warnings that are stored in the prolint database, you can use the windows "Statistics by rule" and "Statistics by subdirectory".
These windows can be launched from the Prolint Desktop window.


Roundtable Check-in Validation

Each time you want to check-in an object, or when you want to complete a task,
Prolint will validate the objects.
When Prolint finds errors (not just warnings) it will tell Roundtable to abort the operation.
Errors must be fixed before the object can be checked-in. This way you can enforce that objects conform to specific standards.

Not every Prolint warning is an error. You can define in much detail which Prolint warnings will be upgraded to errors.


These definitions can be different for each workspace, if you want.

When the object you want to check in is an includefile, Prolint will randomly select three objects that depend on this includefile and lint them instead. The number of includefiles (default 3) can also be configured.
Read more on setup and configuration.

When Prolint finds errors, it will show the following message box:


Roundtable integration

Prolint and Roundtable are integrated in several ways:

  1. Populate the "select files to lint" dialog with sourcefiles from the current RTB task
  2. Custom menu-items and button on the Roundtable Tabletop enable you to easily invoke Prolint.
  3. Prolint can validate sourcefiles before they are checked-in, and disallow check-in if the sourcefile contains specific lint warnings

Notes:


Install Proparse first

Download Proparse

Prolint is based on Proparse, the parser for Progress sourcecode created by Joanju.

Prolint release 74 does not work with Proparse.DLL anymore, instead it requires Proparse.NET.
You can download Proparse.NET from www.joanju.com/proparse.

Proparse.NET comes as a zipfile with three .NET assemblies in it.


the LPGL license

Prolint is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

Prolint is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

A copy of the GNU Lesser General Public License is


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.


#
Syndicate content