AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Neuer FixInsight ist da!

Ein Thema von Insider2004 · begonnen am 11. Feb 2015 · letzter Beitrag vom 24. Apr 2016
Antwort Antwort
Seite 5 von 7   « Erste     345 67      
Der schöne Günther

Registriert seit: 6. Mär 2013
6.159 Beiträge
 
Delphi 10 Seattle Enterprise
 
#41

AW: Neuer FixInsight ist da!

  Alt 26. Mär 2015, 11:20
Thank you for your reply.

Regarding excluding code from being checked, you mean like this?
Take this:
Delphi-Quellcode:
unit SomeUnit;

interface

type
   TParent = class
      procedure someVirtualMethod(); virtual;
   end;

   TChild = class(TParent)
      procedure someVirtualMethod(); override;
   end;

implementation

{ TParent }

procedure TParent.someVirtualMethod();
begin
   WriteLn('Quack!');
end;

{ TChild }

{$IFNDEF _FIXINSIGHT_}
procedure TChild.someVirtualMethod();
begin
   // No quack at all
end;
{$ENDIF _FIXINSIGHT_}

end.
Do you think it would also be possible to further specify which warning or convention to ignore? In this case, I'd only like to ignore a W519 but lose all the other cool warnings and conventions as well.
  Mit Zitat antworten Zitat
Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.016 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#42

AW: Neuer FixInsight ist da!

  Alt 26. Mär 2015, 12:36
Do you think it would also be possible to further specify which warning or convention to ignore? In this case, I'd only like to ignore a W519 but lose all the other cool warnings and conventions as well.
Given how DelphiAST works I think that is not so trivial. The trick with the $IFNDEF just works because it ignores that part of code because the define is set by FixInsight.
For using the same technique it would require multiple parses for each rule or including ifdefs into the AST which currently is not the case.

A different approach could be like rule suppressions in StyleCop work.
But using attributes for such purpose will lead to W1025 when compiling that code unless you add a unit with dummy attributes.

Edit: Ok, maybe a combination of both could work... something like this:

Delphi-Quellcode:
{$IFDEF _FIXINSIGHT_}[SuppressRule(W519)]{$ENDIF}
procedure TChild.someVirtualMethod();
begin
   // No quack at all
end;
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight

Geändert von Stevie (26. Mär 2015 um 12:43 Uhr)
  Mit Zitat antworten Zitat
Benutzerbild von Uwe Raabe
Uwe Raabe

Registriert seit: 20. Jan 2006
Ort: Lübbecke
11.453 Beiträge
 
Delphi 12 Athens
 
#43

AW: Neuer FixInsight ist da!

  Alt 26. Mär 2015, 13:36
Delphi-Quellcode:
{$IFDEF _FIXINSIGHT_}[SuppressRule(W519)]{$ENDIF}
procedure TChild.someVirtualMethod();
begin
   // No quack at all
end;
How long is this "SuppressRule" valid: Only for the following method or for the rest of the unit?

We have a similar problem when dealing with string constants and localization tools automagically extracting those from the sources. It is quite common for these tools to accept a special formatted comment to ignore such a constant. If you scan the Delphi source you will find lots of comments like { Do not localize } which are valid for the current line. Perhaps we can have a similar approach for FixInsight warnings.

Delphi-Quellcode:
procedure TChild.someVirtualMethod(); { FIXINSIGHT: SuppressRule(W519) }
begin
   // No quack at all
end;
As the comment lies inside the method implementation the scope should be obvious. Depending on the nature of any rule other intrinsic scopes may be appropriate.
Uwe Raabe
Certified Delphi Master Developer
Embarcadero MVP
Blog: The Art of Delphi Programming
  Mit Zitat antworten Zitat
Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.016 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#44

AW: Neuer FixInsight ist da!

  Alt 26. Mär 2015, 13:42
How long is this "SuppressRule" valid: Only for the following method or for the rest of the unit?
For exactly the element it was put on. In this case for the entire method. Personally I would not make it too fine grained.
In the end we want to find bad code and not put suppress rule directives all over the place, right?

We have a similar problem when dealing with string constants and localization tools automagically extracting those from the sources. It is quite common for these tools to accept a special formatted comment to ignore such a constant. If you scan the Delphi source you will find lots of comments like { Do not localize } which are valid for the current line. Perhaps we can have a similar approach for FixInsight warnings.

...

As the comment lies inside the method implementation the scope should be obvious. Depending on the nature of any rule other intrinsic scopes may be appropriate.
As I said, the current implementation of DelphiAST limits the possibilities. Comments won't work either since they are not part of the generated AST (afaik).
To my knowledge FI works on the generated AST. Anything that is not part of that AST cannot be taken into consideration.
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat
Roman Yankovsky

Registriert seit: 18. Feb 2015
 
#45

AW: Neuer FixInsight ist da!

  Alt 26. Mär 2015, 14:22
Regarding excluding code from being checked, you mean like this?
Take this:
Yes, exactly like this.

Regarding your second question about ignoring only a specific warning Stefan is right, it's not a trivial task. I'm thinking about implementing this though.

Do you think it would also be possible to further specify which warning or convention to ignore? In this case, I'd only like to ignore a W519 but lose all the other cool warnings and conventions as well.
Given how DelphiAST works I think that is not so trivial. The trick with the $IFNDEF just works because it ignores that part of code because the define is set by FixInsight.
For using the same technique it would require multiple parses for each rule or including ifdefs into the AST which currently is not the case.
I was thinking about something like this:
Delphi-Quellcode:
{$FIOFF W509}
procedure Method;
begin

end;
{$FION W509}
It's still not trivial, but I think I can handle this directives in DelphiAST by adding a certan attribute to all syntax nodes between $FIOFF and $FION. Not in DelphiAST itself of course, but it is possible to inherit it and override a few methods. And as you have mentioned above, attributes is another option.
  Mit Zitat antworten Zitat
Der schöne Günther

Registriert seit: 6. Mär 2013
6.159 Beiträge
 
Delphi 10 Seattle Enterprise
 
#46

AW: Neuer FixInsight ist da!

  Alt 26. Mär 2015, 18:51
I don't know about this DelphiAST, but what about the other way around? Just parse as you always do. We now have a list of warnings and the line number it occurred on.

So in case the code goes like this
Delphi-Quellcode:
25:   procedure TChild.someVirtualMethod();
26:   begin
27:    // No quack at all
28:   end;
, there is a W519 raised for line 25. Now before outputting our results to the IDE's listbox, let's check line 25 whether it contains a comment with an exclamation mark followed by "W519".

So if the code is like
Delphi-Quellcode:
25:   procedure TChild.someVirtualMethod(); //!W519 because FixInsight is smart
26:   begin
27:    // No quack at all
28:   end;
, there will be no "false positive".
  Mit Zitat antworten Zitat
Roman Yankovsky

Registriert seit: 18. Feb 2015
 
#47

AW: Neuer FixInsight ist da!

  Alt 26. Mär 2015, 22:29
Nice idea
  Mit Zitat antworten Zitat
Benutzerbild von jaenicke
jaenicke

Registriert seit: 10. Jun 2003
Ort: Berlin
9.585 Beiträge
 
Delphi 11 Alexandria
 
#48

AW: Neuer FixInsight ist da!

  Alt 27. Mär 2015, 06:20
This could even be expanded to the whole unit scope (for example for 3rd party units, where only the first line would have to be modified then):
Delphi-Quellcode:
unit Example; //!W519 (cannot be fixed because of...)
...
Sebastian Jänicke
Alle eigenen Projekte sind eingestellt, ebenso meine Homepage, Downloadlinks usw. im Forum bleiben aktiv!
  Mit Zitat antworten Zitat
freimatz

Registriert seit: 20. Mai 2010
1.444 Beiträge
 
Delphi 11 Alexandria
 
#49

AW: Neuer FixInsight ist da!

  Alt 27. Mär 2015, 17:04
Hallo,
habe heute mal die Demo installiert. Bei Aufruf mit einem meiner Projekte kommt ein EStringListError in Classes.TFileIterator.Next. (nach madExcept) Eine Ausgabe kommt dann bei continue trotzdem. Umständlich ist, dass mich die meisten units des Projektes gar nicht insteressieren.
Bei Aufruf von Kommandozeile geht gar nichts. D.h. FixInsightCL nacht eine kleine Pause und beendet dann. Zumindest bei --output und --xml hätte ich eine leere xml erwartet.
The EStringListError is fixed today.
Please download the latest build http://sourceoddity.com/download/Fix...upd1_setup.exe

Unfortunately, I cannot reproduce the issue ...
Nach Installation der neuen Version ist alles gut
  Mit Zitat antworten Zitat
schöni

Registriert seit: 23. Jan 2005
Ort: Dresden
445 Beiträge
 
Delphi 7 Personal
 
#50

AW: Neuer FixInsight ist da!

  Alt 27. Mär 2015, 21:36
Ab welcher Delphi Version kann man das einsetzen?

Ab welcher Windows Version funktioniert das Tool?

@freimatz: Ist das gefixte Tool im Link die Demo- oder die Vollversion?
Damit der Topf nicht explodiert, lässt man es ab und zu mal zischen.

Geändert von schöni (27. Mär 2015 um 21:51 Uhr)
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 5 von 7   « Erste     345 67      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:28 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz