Your comments

As an additional metric the ratio of comment lines to source code lines could be taken into account.

Any chance that Rolands and Vincents suggestions get implemented? This would be very helpful indeed.

Should read "W525 not detected", but I got the numbers reversed...

The first case:

  with A, B do <-- would expect a C108 warning here. I consider this a "nested with" too
    WriteLn(NA, NB); 

is unfortunately becoming important for us. We have installed a rule that fails the build when people add new nested with statements, but now, developers are smart ;), new
"with a,b do" 
statements creep into the code, which is not what we intend ...

Sorry, my fault. And unfortunately the replies from userecho landed in my spam folder this weekend, which is why I didn't answer sooner.

I obviously made the error with index 1 and 2 instead of 0 and 1 and copied the error into the other rows when trying to figure out what went wrong. When I use 0 and 1, no false positives are shown.

But obviously the FI message could benefit from a little improvement. The number of parameters is correct, but the indexes are not. So it was no "false" positive, but a positive with a misleading message.


If you don't want to implement an extra warning, please consider changing the message to:

W513: "Format parameter count mismatch or index of parameter out of range"


Would it be possible for you to check the parameter types for compatibility? Because errors there will crash the applicaton at runtime.


Something like

var
  iError: integer;
  sError: string;
begin
  Format('Code %s [%d]', [sError, iError]);
  Format('Code %d [%d]', [iError, sError]); <-- Wxxx Parameter data type doesn't match placeholder
end;

Cheers & thanks

That was me, by the way. Forgot to sign in ...

A somewhat simpler example is here. Same symptom:


if FRxMsg.Valid then
    Sleep(TIME_SLEEP_SHORT)
  else
    Sleep(TIME_SLEEP_SHORT);

would expect a W507.

It does detect the second "with", when the code is copied into a .pas file. It doesn't detect the second with in a dpr as in the above example.

Thanks for the quick reply Roman,


on the Website's download section it's not obvious what the current release is. You have to hover over the download button to see that it is update 6 right now. Could you please place this information near the download button or in the last paragraph of the "what's new" section?


I really didn't notice that there was a newer version than upd5 available. Otherwise I would have just installed the latest version and probably not written this report... :)