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!


Compare Lint Sessions

[Procedure: prolint/prolintdb/lintstats.p invoked by prolint/outputhandlers/logwin.w]


Find Lint Session

[Procedure: prolint/prolintdb/findsessions.w invoked by either prolint/core/selectfiles.w or prolint/outputhandlers/logwin.w]

The Find Sessions window presents a browse of all sessions matching the filter criteria (by default, today and your userid).


leavemodal

Modal Leave Trigger -- has RETURN NO-APPLY

Rule "leavemodal" gives this warning when it finds a LEAVE trigger in the user-interface code that contains a RETURN NO-APPLY statement.

"return no-apply" in a leave trigger is bad because it creates a modal UI, where the user isn't free to
enter data in the order they choose. 99% of the time it can be fixed by just removing the line. You need to have code later (e.g. at save time) to validate the data anyway, since you can't guarantee that the user will put focus in every field.


where-cando

CAN-DO Functions used in WHERE clause

Rule "where-cando" gives this warning when it finds a WHERE clause that contains a CAN-DO function.

the risc:

Performance is bad

How to suppress these warnings:

You can put the directive {&_proparse_ prolint-nowarn(where-cando)} directly before
the statement that contains the WHERE clause. See also: suppress warnings.


new rule: "leavemodal" looks for LEAVE triggers with RETURN NO-APPLY

Submitted by Tim Townsend

"return no-apply" in a leave trigger is bad because creates a modal UI, where the user isn't free to enter data in the order they choose. 99% of the time it can be fixed by just removing the line. You need to have code later (e.g. at save time) to validate the data anyway, since you can't guarantee that the userwill put focus in every field.


new rule: "where-cando" looks for CAN-DO in a WHERE clause

submitted by Tim Townsend, all credits to Tim

This is a new Prolint rule that searches for "WHERE ... CAN-DO( )" because it is a slow query


Index out of bounds

After parsing a folder with 7000 programs, the prolint result screen errors out. I got around 15,000 warnings from the scan. As it's about to fill the prolint results screen this appears.

Error occured while accessing component property/method ADD
Index out of bounds
Error code: 0x80020009 createSourceNodes prolint/outputhandlers/logwin.w (5890)

Then..

Invalid component-handle referenced while processing method/statement: TAG
createSourceNodes prolint/outputhandlers/logwin.w (5884)

Unable to set com handle property.

The screen won't load, I cannot view the results.


rule "tablename" should skip buffer-compare

Tim Townsend wrote:

There's code in tablename.p that excludes unqualified field name references that appear in an EXCEPT clause in a BUFFER-COPY statement. I think it should also exclude a similar clause in a BUFFER-COMPARE statement.

The relevant code looks looks like this:

   /* verify if this EXCEPT node is in a BUFFER-COPY statement */
    IF parserNodeStateHead(theNode, child) <> "BUFFERCOPY":U THEN
      RETURN.

I changed it like this and it does what I want:

   /* verify if this EXCEPT node is in a BUFFER-COPY/COMPARE statement */

Thoughts on the Desktop

OK, so I've been using Prolint off-and-on for about 3 weeks now, and I have a couple thoughts about the main UI component, the Prolint Desktop window (desktop.w) and how it's usability could be improved.


Enhance database tracking

PROFILER stores all runs with a 'profiler id' so that you can look at things over time, or just attach a profiler ID to a ticket or email for a reviewer to look at. ProLINT records only the last LINT run of a program in the database, and does not have a nice way of retrieving the information later by another user, or a way of identifying the lint results to be reviewed by the reviewer.


Start up desktop gives error "cannot find the location of the file protools.dat".

"You probably have to use the standard PRO*Tools customization dialog first to specify that you want to save the palette position."


"put-key-value" without "no-error"

Prolint should have a rule that warns when it sees a PUT-KEY-VALUE statement without the NO-ERROR option.


Excel can't find file

Excel doesn't have the same working directory as the Progress session, so it can't find the xml file prolint is trying to make it open when it has a relative path. Need to change logexcel.p (near the end) to open the file like so:

file-info:file-name = Logfile.
chExcel:Workbooks:OPEN(file-info:full-pathname).

Also the comment right after that about the release statement closing excel puzzles me, since when I put the release statement back in Excel does not close.

-Tim Townsend


Don't assume you can write to a file

A trend I've noticed in software development is that more and more companies are putting their developers in locked-down, controlled environments where they can't change anything about the tools they use. For example using WTS or Citrix to connect to a box where Progress and the other tools are installed.


tablename reports unqualified fields in FIELDS()

Code such as:
FOR EACH Customer FIELDS(Id Name) NO-LOCK:

reports that the "Id" and "Name" should be qualified with table name.

But it is safe as FIELDS statements can only apply to the table specified and if a field is specified that does not exist in the table the code will not compile.

e.g.
FOR EACH Customer FIELDS(banana) NO-LOCK:

results in:
syntax error "** Field banana does not exist in table Company. (442)

Please amend this rule to ignore FIELDS statements.


#
Syndicate content