This article was brought to you by the guys from VDF-GUIdance.
For more DataFlex targeted articles see http://www.vdf-guidance.com


Unused Variables

by Bob Worsley

Summary

This is a tool to check source code for local variables that have been delared but not used. It can either be run as a standalone application or since the subroutine that does the work is a class, it can be used in other applications.
Size: 20 KB Download
Date Created: 03/11/2008
Date Updated: 10/03/2017
Author: Bob Worsley


2017-10-01 Unused Variables ~ 949KB


Unused Variable Checking



Extra local variables are always created in the normal development process especially
during a rewrite of an older program. By themselves they don't really harm anything,
but can sometimes be confusing to the developer.

The goal of this program is to either show or output any unused variables to a log file.
A workspace selector isn't provided, operation is thought to be one of the following:
1. Run from the tools menu in the Studio or the Hammer
2. Copy the executable to the programs directory of the workspace where you want to check source
3. Simply use the file dialog to find the source you want.

Output will be to an edit object in the view or if file output is selected, then the log will be written to the directory where the source is being checked.

A registry entry will be written that lets the program "remember" the last directory
that was worked in.

Two outside packages are used, vWin32fh.pkg library from vdf-Guidance, and the StringTokenizer
by Torkild Resheim. The StringTokenizer is provided with this application, vWin32fh
is not because it's an evolving package and you should obtain the latest from vdf-Guidance.
There will be some conditions or variable types that haven't been included
or thought of, so let the author know if so. Usually this will show up as a missing method name
or blank variable name. And usually it's a simple answer - another trim necessary, or
a comparison that requires an extra space somewhere.

Bob Worsley
rlworsley@gmail.com

Changes


2008-04-12 Fixed a few bugs, made it into a class so it is easier to incorporate in other apps and made a few minor adjustments.
2017-08-20 Replaced the showln output box with an edit object in the view and added command line functionality for potential use in the Studio or the Hammer. In addition this workspace now uses the vWin32fh library available here in vdf-Guidance.com
2017-08-26 Added a "batch" function that will process all source files in an entire folder at one time. Added a help file & button.
2017-10-01 Added the ability to actually remove unused variables from the source code in single or batch mode. Updated source is written to a different directory

Download



2017-10-01 Unused Variables ~ 949 kB
2017-08-26 Unused Variables ~ 22kB
2017-08-21 Unused Variables ~22 kB
2008-04-14 Unused Variables ~ 20 kB
2008-03-11 Unused Variables ~ 58 kB

Subversion repository


This project is under version control using subversion software.
The URL for the project is:

http://svn.vdf-guidance.com/UnusedVariables/trunk