views:

260

answers:

3

I need an analysis tool that will help to enforce coding standards for our Delphi codebase.

A few colleagues have suggested the following tools:

  1. Code healer
  2. Pascal analyzer

I've had a look at these tools and they aren't suitable. I was hoping to find a tool for Delphi that is similar to CheckStyle for Java or StyleCop for C#.

Any suggestions?

Thanks in advance.

+3  A: 

it seems those 2 are the most used. also you can try

http://jedicodeformat.sourceforge.net/

best regards, Radu

Radu Barbu
Thanks Radu, but I'm more interested in a tool that produces a report, rather than a tool that actually goes ahead and reformats the code.
Ben Clews
+3  A: 

Some newer editions of Delphi offer Audits and Metrics in the Model view, which can also be configured to set allowed limits. They do not run from command line for build integration afaik so I found them not very helpful.

I know the highly customizable Java (and .Net tools) like PMD, FindBugs and CheckStyle which generate XML or HTML statistic reports, and also integrate very well with build tools (Ant, Maven, Hudosn) - but for Delphi nothing comparable has crossed my road so far.

mjustin
Thanks Mike. Unfortunately, it does appear that Delphi does lag behind quite a bit in this area.
Ben Clews
+1  A: 

The best one is Pascal Analyzer (PAL) by Peganza, which you said you tried and found unsuitable, but did not say why. I will say a bit in its favor: It's Commercial, inexpensive, and so worth it. They recently released version 5, and if version 5 doesn't do what you want, you should tell them what you want, because they have always answered my requests whenever I have mentioned a feature I wish the product would add.

We use it instead of the high-end SKUs of Delphi's metrics because it costs less and does more than the built-in $3000 stuff. I think it costs about $160 us.

I am a happy customer. Here is a sample of some of the metric areas that I like: convention compliance - class names that don't start with T, exception types don't start with E, class fields not in private, identifiers with goofy names, class visibility confusion or bad order, local identifier/unit outer scope identifier clashes. Inconsistent case, Many many many more!

alt text

The weakness is that the output is plain text in a "TMemo" control. Of course, I have found a lot of ways to take that output and write my own small sort/filter utilities to mine even more useful stuff from the reports. A powerful tool that you won't be able to live without once you try it.

I realize you said in your answer that you tried that already, but if it's not what you want, it's already the best LINT like tool for Pascal that currently exists.

Warren P
Thanks Warren. Pascal Analyzer certainly is a very good piece of software. We currently use PAL for the metrics it produces. However, we found that the "convention compliance" checks were very basic and no where near as comprehensive as CheckStyle is for Java. Also, PAL doesn't allow you to write your own checks (as far as I'm aware).
Ben Clews
The ability to use PAL's parser plus your own strings (regex + some boolean logic conditions) would be a fabulous idea to suggest to the PAL guys. If you don't, I will.
Warren P