How Project Analyzer works

When you start Project Analyzer, or when you choose File|Analyze, you get a dialog box asking to choose a project file. Project Analyzer can read all project file types: .mak, .vbp, .vbproj, even .ebp and .vbdproj (see Supported languages for the details). The Enterprise Edition also reads .vbg and .sln files. By reading the file, Project Analyzer finds out what files belong to your project(s). Start an analysis

What kind of files does Project Analyzer analyze?

Project Analyzer examines most file types belonging to your project. First of all, it analyzes all the source code files, such as .bas, .frm, .cls, .ctl and .vb. Binary extension files, such as .frx and .ctx, are also analyzed. Project Analyzer also detects what's being used in a .dll library file via the Declare statement.

Analysis of COM files (.exe, .dll, .ocx, .tlb, .olb) is possible in the Enterprise Edition. Project Analyzer analyzes the public interface of these files, that is, the classes, methods and other data types you can use from these files. More

Limitations. Project Analyzer doesn't analyze .vbx, .dsr, .res nor .resx files. It doesn't read source code in other languages than Visual Basic, such as C#, C/C++ or J#. What is more, it doesn't read VB3 source code files saved as binary. If you use VB3, remember to save your files in text format. Project Analyzer can only read VB files that have been saved in text format.

VBA Plug enables Project Analyzer to read Office VBA projects stored in files such as .xls, .doc, .mdb, .ppt or .vsd.

How does the analysis work?

Project Analyzer reads your files in two phases. The analysis method is called static source code analysis. The analysis engine was specifically developed for Project Analyzer to allow as accurate analysis as possible. Although it assumes that the code is syntactically correct and compilable, an occasional programming error or a missing file do not affect the results much. Thus, you can analyze code that does not work or analyze just a part of a program, although you may only expect complete results from a complete analysis.

Phase 1/2. Basic information about the structure of your project is collected, including: procedure names, procedure parameter names, variable names, constant names, Type definitions, Enum definitions, control names. Some basic metrics, like lines of code, are calculated too, and some problems are detected. After this phase you can start surfing around your project in Project Analyzer, but you don't yet see all of the analysis results.

Phase 2/2. Cross-references are detected. Project Analyzer scans the whole project to find where procedures are called, variables written or read, constants referenced etc. Some more metrics, like nested conditionals, are calculated too. At the end of Phase 2/2 Project Analyzer calculates additional information based on the cross-reference data. It checks if any procedures, variables, constants, Types or Enums are dead. It calculates some of the most advanced metrics, like information complexity. In this phase, Project Analyzer also checks if any more coding problems can be found.

Waiting for the analysis to end

You can use some of the features in Project Analyzer even during the analysis. However, some features are grayed out. Just wait for the analysis to end and you will be able to use them all.

When the analysis is ready, a "Ready!" sign appears. Should you want to stop the analysis earlier, you can press the red circle, the Stop button. In this case, all features such as certain reports will not be available because the analysis was not completed.

How to get better results?

Although Project Analyzer works well with all kinds of VB code, following one rule will make the results much better. Use Option Explicit and declare all your local variables. This is a generally accepted programming standard in VB programming. By doing this, all your variables have a correct type, your code is easier to understand (by humans and computers alike!) and you can probably even avoid a few run-time errors. What is more, if you need to upgrade your code to VB.NET, logically declared variable types will greatly help in that. So what will happen to Project Analyzer if I don't use Option Explicit? Not too much. It will just ignore all those undeclared local variables - and all the problems you may have with their use!

How is Project Analyzer implemented?

Project Analyzer is written in pure Visual Basic, namely VB 6.0 Professional Edition. The analysis engine is self-contained. It does not depend on information retrieved from Visual Basic, Visual Studio or any 3rd-party library. The software is optimized to reliably analyze Visual Basic projects of any size.

Our commitment to VB analysis means that you can trust Project Analyzer. In fact, Project Analyzer occasionally analyzes its own code to optimize itself. Even with our long-time experience in optimized VB coding, it usually finds dozens of places to improve.

Terminology

© Project Analyzer Help