Blog

All Blog Posts  |  Next Post  |  Previous Post

TMS FixInsight v2020.2 is here

Bookmarks: 

Tuesday, February 11, 2020

Our Delphi static code analysis tool just got updated. TMS FixInsight is your indispensable tool to enhance your Delphi code quality and make it less prone to errors than your Delphi compiler warns for.
TMS FixInsight catches numerous classic patterns of mistakes in code and with the new version v2020.2, three new rules have been added:

C11
Exception class name should start with 'E'
This is an obvious rule. TMS FixInsight will now just produce a hint that exception class name should start with E so your code remains as consistent as possible.

W535
Enumerated constant(s) missing in case statement
In the code below, etThree is missing from the case structure and will trigger a warning.

Example:
type
   TEnumType = (etOne, etTwo, etThree);

var
   EnumType: TEnumType;
begin
   case EnumType of // <= W535
     etOne: ;
     etTwo: ;
   end;
end;
It's not always an error, but worth taking a look. Maybe add else statement.

W536
New class instance passed as const interface parameter
This issue is addressed here: https://stackoverflow.com/questions/4509015/should-the-compiler-hint-warn-when-passing-object-instances-directly-as-const-int
and here
https://pascal.today/2016/12/16/take-care-of-const-and-interface-parameters/

Example (see comments in code):
type
   ISomeInterface = interface
   ['{AAAAAAAA-AAAA-AAAA-AAAA-AAAAAAAAAAAA}']
   end;

   TSomeClass = class(TInterfacedObject, ISomeInterface)
   end;

procedure DoSomethingWithSomeInterface(const SomeInterface: ISomeInterface); begin
   // ...
end;

procedure DoSomethingWithSomeClass;
begin
   // ...
   // After this call TSomeClass instance will not be released.
   // There is a potential memory leak.
   DoSomethingWithSomeInterface(TSomeClass.Create); // <= W536
   // ...
end;

The update v2020.2 of TMS FixInsight is available now. All active registered users can get this update after login on our website.

Bruno Fierens


Bookmarks: 

This blog post has not received any comments yet.



Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.



All Blog Posts  |  Next Post  |  Previous Post