Enter forum description here ...
+4
Planned

Warning whn doing direct Floating point compare (=, <, > >= <= and <>)

Anonymous 10 years ago updated by Roman 10 years ago 1
It can really lead in weird situations when you something like this

if LDoubleValue = 0.00 then

and should be changed to if SameValue(LDoubleValue, 0.00) then (Super simple case).

when you comparefloating point values are more than less dangerous. And finding them from code is more than less tedious job. Have to find out what the types being compared actually are. (did not check but how this is compiled if LDoubleValue >= LIntValue then... Is the Integer converted Float before compare, but still it might be epsilon away from the even integer value??)

Anyways this can lead to very subtle bugs in your code and very hard to debug and so on. I would predict that getting these out from the legacy code without helping hand is very hard work :)
+3

Statistics in Results window

il2 9 years ago 0

Would be useful to show header line with start time/FI version and footer line with end time, check duration, number of files, number of issues found, average speed scan in Results window.

For example:

[Info] 2016-03-29 01:01:01 FixInsight 2016.03 started

....

[Info] 2016-03-29 01:01:45 FixInsight 2016.03 found 10C/12W/15O issues, 44 sec, 1000 files, 50 KB/sec

or

[Info] 2016-03-29 01:01:45 FixInsight 2016.03 no issues found, 44 sec, 1000 files, 50 KB/sec

+3

[W521] Now shown when using unitialized Result in right side of assignment

Anonymous 10 years ago 0
This code does not trigger the warning:

{code}
function DoSomething(const s: string): string;
begin
if StartsStr('\', s) then
Result := Copy(Result, 1);
end;
{code}

Yes, the code snippet does not make any sense and the real code is a bit more complex but the fact that the right side of the assignment contains Result is causing the warning to not be shown.
+2
Completed

Add Conmment "directive" so can suppress FixInsignt false positivie (if needed)

Anonymous 10 years ago updated by Roman 10 years ago 3
Like this kind of
try
LMyObject := DoSomethingWhichSometimesRaiseExcptionWhichICantDoNothingOrByDesign;
except
{ Eat this exception because of this and that FixInSigntSuppressWarnings(W501) }
end;

Would be cleaner the use Comments IMHO than some compiler directive way present now (I think)
+2
Completed

Show the name of the class and field in C107 "Class field name should start with 'F'

Anonymous 10 years ago updated by Roman 10 years ago 2
It would be helpful, if the C107 message "Class field name should start with 'F'" contained the class name and field name e.g. "Class field name 'TMyClass.SomeField' should start with 'F'"
+2
Completed

Split rule W504 Missing INHERITED call in constructor/destructor

Maik Görtz 10 years ago updated by Roman 10 years ago 2
We are using FixInsight in our build chain. Not calling inherited in destructor should be an exception. But not calling inherited in constructor should be a warning. To interprete so from build server it has to be two seperate rules.
Answer
Roman 10 years ago
Agree, that's good point. This will be implemented in the next update
+2
Completed

New warning: uninitialised managed results in methods

Anonymous 10 years ago updated by Roman 10 years ago 3
The Delphi compiler warns you if a function may not have had its Result initialised, if it is a simple / unmanaged type (eg an integer.) However, it doesn't do this if it is a managed type, like an interface or string. IMO it should - not initialising a result is a problem - and it'd be great if this warning could be implemented in FixInsight.
+2
Planned

Add warning when a class's constructor exists, but the code calls an ancestor's constructor instead

David Millington 10 years ago updated by Nicholas Ring 10 years ago 2
It is quite possible / easy to construct an object by calling a classes' ancestor's constructor, instead of a constructor for the class you want to create. This leaves you with a partially constructed object, not a good thing.

One simple way to demonstrate this:

type
TFoo = class
constructor Create;
end;
TBar = class(TFoo)
protected // !
constructor Create(a : integer);
end;

// In another unit (!)
Bar := TBar.Create; // Calls TFoo.Create because TBar.Create is not visible outside the unit

I'd like a warning something like, "TBar has a constructor defined, but Bar is being constructed with ancestor class TFoo's constructor."

This is not quite as uncommon a circumstance as you might think - as well as the above, which would trip up any C++ programmer who would expect a compile error if it was calling the wrong constructor, there are also possibilities to do this when some but not all constructors are overridden, etc, too. I've seen bugs caused by this several times.
+2
Completed

Add a warning 'inherited call missing in constructor'

Anonymous 10 years ago updated by Roman 10 years ago 2
This would be similar to the existing warning for destructors. If a constructor doesn't call an inherited constructor, it should warn.
+2
Planned

Request Warning: class field hides a class field of parent class

Martin Wienold 10 years ago updated by Vincent Parrett 10 years ago 2
I don't know if it possible for FixInsight to detect his, but here is my use case.
I have two classes, TParent and TChild, and a class field in TChild hides a class field defined in TParent.

unit FixInsightTest;

interface

uses
  SysUtils,
  Classes;

type
  TParent = class(TPersistent)
  private
    fPrivate: string;
  protected
    fProtected: string;
  public
    fPublic: string;
  end;

  TChild = class(TParent)
  private
    fPrivate: string;   // this is fine, since it's private for this class
  protected
    fProtected: string; // class field hides class field of parent class
  public
    fPublic: string;    // class field hides class field of parent class
  end;

//
//  Tested with FixInsight 2015.04
//
//  This is somehow related to the warning W517, but this is a special case
//  because the current class' field hides a field of the parent class
//
//    "W517 Variable '%s' hides a class field, method or property"
//

implementation

end.