-
Sep 8th, 2020, 09:32 AM
#1
[RESOLVED] VB ADD-INS for analyzing variable names
I never use Add-Ins, but reading around I understand people are using it.
one Add-ins that I would love to have is something like this:
- a variable analyzer
will check all variables, public or private and see if those are used at all and if different modules uses the same variable and inform me theres a doublet.
- a function name and variable analyzer
like the above, if a function, private or public is used in another module, if so, inform me as well, and also, if variables used inside the functions are also used as module variables
example:
Code:
module1
Dim MyVar as Long
Dim ThatVar as Integer
Public OtherVar as Long
Public SameVar as Long
Function MyFunc()
Dim MyVar as Long
OtherVar = OtherVar + 1
End Function
module2
Dim MyVar as Long
Function AnotherFunc()
Dim SameVar as Integer
SameVar = SameVar + 1
End Function
a report will tell:
MyVar is found in module1, module2, module1(MyFunc)
OtherVar in module1 is a Public variable but only used in module1
SameVar in module1 is a Public variable a doublet conflict in module2(AnotherFunc) could cause errors.
ThatVar in module1 is never used.
and so on.
is there ADD-INS that have this?
-
Sep 8th, 2020, 09:51 AM
#2
Re: VB ADD-INS for analyzing variable names
Hi Baka,
I'm not sure it takes an Add-In to do this. In fact, if I were to do it, I'd definitely get it running as a regular program first, and then maybe think about making it an Add-In. And LaVolpe's Project Scanner comes pretty close to getting this done.
Best Regards,
Elroy
Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.
-
Sep 8th, 2020, 09:59 AM
#3
Re: VB ADD-INS for analyzing variable names
Have a look at MZTools, it doesn't do everything you asked for, but does dead code and unused variables.
Also handy:
https://www.vbforums.com/showthread....-Addin-for-VB6
And the Callers AddIn by RDE, came from PSC:
https://www.vbforums.com/showthread....=1#post5409319
-
Sep 8th, 2020, 11:35 AM
#4
Re: VB ADD-INS for analyzing variable names
Originally Posted by Elroy
That project can perform those tasks. But the task of identifying duplication; only if under one condition... The duplicated variables and functions are public or (in same scope of the code page and declared in the declarations section). For example, "Dim I As Integer" will not flag that variable as 'duplicated' if it is a local declaration to a method/property, regardless how many methods use same declaration. I felt that type of specific check was literally a waste of time IMO.
-
Sep 8th, 2020, 11:36 AM
#5
Re: VB ADD-INS for analyzing variable names
Hi Elroy
I did try it and its very useful.
got a bunch of results so I can clean up a bit.
usually its when I update a function and I leave the "old" stuff and forget to remove it.
-
Sep 8th, 2020, 11:38 AM
#6
Re: VB ADD-INS for analyzing variable names
Yes, LaVolpe's project can do it, and in combination with VBIDEUtils (addin open source now), you could find nearly everything
I use both for my projects
-
Sep 8th, 2020, 11:49 AM
#7
Re: VB ADD-INS for analyzing variable names
Originally Posted by baka
...usually its when I update a function and I leave the "old" stuff and forget to remove it.
One of the reasons I designed it -- applies to all of us. For me, I tend to have test code (methods & variables) that are left behind and never used again after testing. In smaller projects, those are easy to see. But in large projects, they can get 'lost'. That tool can help find those too.
-
Sep 8th, 2020, 11:52 AM
#8
Re: [RESOLVED] VB ADD-INS for analyzing variable names
NB : For testing, I always tag like ' ######
So I can do a search for the string to remove the uneeded lines
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|