Skip to content

Commit

Permalink
Fix insight Checks
Browse files Browse the repository at this point in the history
Ran and corrected Fix insight Checks.
  • Loading branch information
DGH2112 committed Mar 17, 2018
1 parent f164c6c commit 4a119ee
Show file tree
Hide file tree
Showing 9 changed files with 122 additions and 30 deletions.
71 changes: 71 additions & 0 deletions OTAIntfSearch.ficfg
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<FixInsightSettings>
<Rules>
<Rule101 enabled="true">
<Value>50</Value>
</Rule101>
<Rule102 enabled="true">
<Value>7</Value>
</Rule102>
<Rule103 enabled="true">
<Value>7</Value>
</Rule103>
<Rule104 enabled="true"/>
<Rule105 enabled="true"/>
<Rule106 enabled="true"/>
<Rule107 enabled="true">
<private>true</private>
<protected>true</protected>
<public>false</public>
<published>false</published>
</Rule107>
<Rule108 enabled="true"/>
<Rule109 enabled="true"/>
<Rule110 enabled="true"/>
<Rule501 enabled="true"/>
<Rule502 enabled="true"/>
<Rule503 enabled="true"/>
<Rule504 enabled="true"/>
<Rule505 enabled="true"/>
<Rule506 enabled="true"/>
<Rule507 enabled="true"/>
<Rule508 enabled="true"/>
<Rule509 enabled="true"/>
<Rule510 enabled="true"/>
<Rule511 enabled="true"/>
<Rule512 enabled="true"/>
<Rule513 enabled="true"/>
<Rule514 enabled="true"/>
<Rule515 enabled="true"/>
<Rule517 enabled="true">
<fields>true</fields>
<methods>true</methods>
<properties>true</properties>
</Rule517>
<Rule519 enabled="true"/>
<Rule520 enabled="true"/>
<Rule521 enabled="true"/>
<Rule522 enabled="true"/>
<Rule523 enabled="true"/>
<Rule524 enabled="true"/>
<Rule525 enabled="true"/>
<Rule526 enabled="true"/>
<Rule527 enabled="true"/>
<Rule528 enabled="true"/>
<Rule529 enabled="true"/>
<Rule801 enabled="true"/>
<Rule802 enabled="true">
<interface>true</interface>
<implementation>true</implementation>
</Rule802>
<Rule803 enabled="true">
<interface>true</interface>
<implementation>true</implementation>
</Rule803>
<Rule804 enabled="true"/>
<Rule805 enabled="true"/>
<Rule530 enabled="true"/></Rules>
<General>
<IncludeSearchPath>true</IncludeSearchPath>
<HintOnUselessIgnoreComment>true</HintOnUselessIgnoreComment><IgnoreFileNames><Name>VirtualTrees.pas</Name><Name>Syn*.pas</Name></IgnoreFileNames></General>
</FixInsightSettings>
4 changes: 2 additions & 2 deletions OTAIntfSearch.ithelper
Expand Up @@ -10,7 +10,7 @@ CompileWithBRCC32=0
MajorVer=1
MinorVer=1
ReleaseVer=2
BuildVer=573
BuildVer=577
ResourceName=OTAIntfSearchITHVerInfo

[Zipping]
Expand All @@ -22,7 +22,7 @@ ExclusionFiles=
[VersionInfo]
CompanyName=Season's Fall Music
FileDescription=OTAIntfSearch: An application to allow you to search interfaces / classes and method properties for matching text.
FileVersion=1.1.2.573
FileVersion=1.1.2.577
InternalName=OTAIntfSearch
LegalCopyright=Season's Fall Music
LegalTrademarks=Season's Fall Music
Expand Down
6 changes: 3 additions & 3 deletions OTAIntfSearchITHVerInfo.RC
@@ -1,8 +1,8 @@
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

1 VERSIONINFO LOADONCALL MOVEABLE DISCARDABLE IMPURE
FILEVERSION 1, 1, 2, 572
PRODUCTVERSION 1, 1, 2, 572
FILEVERSION 1, 1, 2, 576
PRODUCTVERSION 1, 1, 2, 576
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
Expand All @@ -13,7 +13,7 @@ FILETYPE VFT_APP
{
VALUE "CompanyName", "Season's Fall Music\000"
VALUE "FileDescription", "OTAIntfSearch: An application to allow you to search interfaces / classes and method properties for matching text.\000"
VALUE "FileVersion", "1.1.2.572\000"
VALUE "FileVersion", "1.1.2.576\000"
VALUE "InternalName", "OTAIntfSearch\000"
VALUE "LegalCopyright", "Season's Fall Music\000"
VALUE "LegalTrademarks", "Season's Fall Music\000"
Expand Down
7 changes: 1 addition & 6 deletions Source/OTAIntfSearch.Constants.pas
Expand Up @@ -4,7 +4,7 @@
@Author David Hoyle
@Version 1.0
@Date 06 Jan 2017
@Date 17 Mar 2018
**)
Unit OTAIntfSearch.Constants;
Expand Down Expand Up @@ -45,11 +45,6 @@
strEndingSemiColonRegEx = '.*; *$';
(** A regular expression for finding functions and properties which return specific
identifiers. **)
strInterfaceMethodSearchRegEx =
'^( |\t)*property *[a-z]+ *: *%s *read *.*; *|' +
'^( |\t)*property *[a-z]+ *[\[].*[\]] *: *%s *read *.*; *|' +
'^( |\t)*function *[a-z]+ *: *%s *; *|' +
'^( |\t)*function *[a-z]+ *[\(].*[\)] *: *%s *; *';
(** A regular expression for checking an identifier for being a service interface. **)
strServiceRegEx = '^( |\t)*I[a-z]+Services[^0-9]*$';
(** A regular expression for finding interface and class identifiers. **)
Expand Down
10 changes: 8 additions & 2 deletions Source/OTAIntfSearch.GenerateOTACode.pas
Expand Up @@ -143,6 +143,8 @@
@precon ParentNode must either be a valid node or Nil.
@postcon A new node is added to the OTA Code tree view.
@nohint iFileIndex
@param ParentNode as a Pointer as a constant
@param iFileIndex as an Integer as a constant
@param iInterfaceObjectIndex as an Integer as a constant
Expand All @@ -151,7 +153,8 @@
@return a Pointer
**)
Function TOISGenerateOTACode.AddNode(Const ParentNode: Pointer; Const iFileIndex, iInterfaceObjectIndex,
Function TOISGenerateOTACode.AddNode(Const ParentNode: Pointer;
Const iFileIndex, iInterfaceObjectIndex, //FI:O804
iMethodIndex: Integer; Const LeafType: TLeafType) : Pointer;

Var
Expand Down Expand Up @@ -446,13 +449,16 @@
FToolsAPIFile interfaces.
@postcon If a duplicate is found a loop node is added under the parent and the functin returns true.
@nohint strIdent
@param ParentNode as a PVirtualNode as a constant
@param strIdent as a String as a constant
@param iInterfaceObjectIndex as an Integer as a constant
@return a Boolean
**)
Function TOISGenerateOTACode.IsDuplicate(Const ParentNode: PVirtualNode; Const strIdent: String;
Function TOISGenerateOTACode.IsDuplicate(Const ParentNode: PVirtualNode;
Const strIdent: String; //FI:O804
Const iInterfaceObjectIndex : Integer): Boolean;

Var
Expand Down
33 changes: 23 additions & 10 deletions Source/OTAIntfSearch.MainForm.pas
Expand Up @@ -615,16 +615,16 @@
strMsg = 'Exception in regular expression "%s":'#13#10'%s';

Var
GenerateOTACode: IOISGenerateOTACode;
GenOTACode: IOISGenerateOTACode;
C: Char;

Begin
If pagViews.ActivePage = tabCreationPaths Then
Begin
GenerateOTACode := TOISGenerateOTACode.Create(FToolsAPIFiles, NodeData.FFileIndex,
GenOTACode := TOISGenerateOTACode.Create(FToolsAPIFiles, NodeData.FFileIndex,
FOTACodeTree, FProgressManager);
Try
GenerateOTACode.GenerateCode(NodeData.FInterfaceObjectIndex, NodeData.FMethodIndex,
GenOTACode.GenerateCode(NodeData.FInterfaceObjectIndex, NodeData.FMethodIndex,
NodeData.FLeafType, edtTargetSearch.Text);
Except
On E: ERegularExpressionError Do
Expand Down Expand Up @@ -992,6 +992,11 @@
**)
Procedure TfrmOTAIntfSearch.UpdateFormTitle;

Type
TBuildRec = Record
FMajor, FMinor, FBugFix, FBuild: Word;
End;

Const
strBuild = '%s %d.%d%s (Build %d.%d.%d.%d)';
strBugFix = ' abcdefghijklmnopqrstuvwxyz';
Expand All @@ -1004,7 +1009,7 @@
VerValueSize: DWORD;
VerValue: PVSFixedFileInfo;
Dummy: DWORD;
iMajor, iMinor, iBugFix, iBuild: Word;
BuildRec : TBuildRec;

Begin
VerInfoSize := GetFileVersionInfoSize(PChar(ParamStr(0)), Dummy);
Expand All @@ -1013,12 +1018,20 @@
GetMem(VerInfo, VerInfoSize);
GetFileVersionInfo(PChar(ParamStr(0)), 0, VerInfoSize, VerInfo);
VerQueryValue(VerInfo, '\', Pointer(VerValue), VerValueSize);
iMajor := VerValue^.dwFileVersionMS Shr iRightShift;
iMinor := VerValue^.dwFileVersionMS And iMask;
iBugFix := VerValue^.dwFileVersionLS Shr iRightShift;
iBuild := VerValue^.dwFileVersionLS And iMask;
Caption := Format(strBuild, [Application.Title, iMajor, iMinor, strBugFix[Succ(iBugFix)],
iMajor, iMinor, iBugFix, iBuild]);
BuildRec.FMajor := VerValue^.dwFileVersionMS Shr iRightShift;
BuildRec.FMinor := VerValue^.dwFileVersionMS And iMask;
BuildRec.FBugFix := VerValue^.dwFileVersionLS Shr iRightShift;
BuildRec.FBuild := VerValue^.dwFileVersionLS And iMask;
Caption := Format(strBuild, [
Application.Title,
BuildRec.FMajor,
BuildRec.FMinor,
strBugFix[Succ(BuildRec.FBugFix)],
BuildRec.FMajor,
BuildRec.FMinor,
BuildRec.FBugFix,
BuildRec.FBuild
]);
FreeMem(VerInfo, VerInfoSize);
End;
End;
Expand Down
4 changes: 2 additions & 2 deletions Source/OTAIntfSearch.ProgressForm.dfm
Expand Up @@ -27,8 +27,8 @@ object frmProgress: TfrmProgress
AlignWithMargins = True
Left = 7
Top = 7
Width = 378
Height = 30
Width = 31
Height = 13
Margins.Left = 5
Margins.Top = 5
Margins.Right = 5
Expand Down
6 changes: 3 additions & 3 deletions Source/OTAIntfSearch.ProgressForm.pas
Expand Up @@ -108,9 +108,9 @@
pbrProgressBar.Style := pbstMarquee
Else
pbrProgressBar.Style := pbstNormal;
pbrProgressBar.Position := iPosition;
pbrProgressBar.Position := iPosition - 1;
pbrProgressBar.Position := iPosition;
pbrProgressBar.Position := iPosition; // Workaround for stupid progress animation
pbrProgressBar.Position := iPosition - 1; //FI:W508
pbrProgressBar.Position := iPosition; //FI:W508
lblFiles.Caption := strFileName;
FLastUpdate := GetTickCount;
Application.ProcessMessages;
Expand Down
11 changes: 9 additions & 2 deletions Test/TestOTAIntfSearch.Constants.pas
Expand Up @@ -112,8 +112,8 @@

Procedure TTestOTAIntfSearchConstants.TestInterfaceClassSearchRegEx;

Var
strSearch : String;
//Var
// strSearch : String;

Begin
// strSearch := Format(strInterfaceClassSearchRegEx, ['IMyOtherInterface']);
Expand All @@ -125,6 +125,13 @@

Procedure TTestOTAIntfSearchConstants.TestInterfaceMethodSearchRegEx;

Const
strInterfaceMethodSearchRegEx =
'^( |\t)*property *[a-z]+ *: *%s *read *.*; *|' +
'^( |\t)*property *[a-z]+ *[\[].*[\]] *: *%s *read *.*; *|' +
'^( |\t)*function *[a-z]+ *: *%s *; *|' +
'^( |\t)*function *[a-z]+ *[\(].*[\)] *: *%s *; *';

Var
strSearchText : String;

Expand Down

0 comments on commit 4a119ee

Please sign in to comment.