You are here: AxTools > CodeSMART 2007 for VB6 > Documentation > User's Guide > Code Analyzer > Potential Problems Detection
While browsing this page, why not start downloading the evaluation setup kit (direct download, no questions asked).

Potential Problems Detection

Testing applications throughout development and especially before delivery is an extremely important component in the software industry. Many errors are usually caused by bad programming habits and various programming methods that are usually known to be unsafe. The CodeSMART Code Analyzer can search for these situations that do not necessarily cause errors but may lead to unpredictable problems when combined with certain pieces of code.

To set the Potential Problems detection options:

  1. In the CodeSMART main menu, select the Code Analyzer entry from the Reviews popup, or click the same button from the Other Tools toolbar to display the Code Analyzer dialog-box (quick toolbar and menu references are available).
  2. Click on the detailed configuration link in order to display the Code Analyzer Options dialog and then activate the Potential Problems tab.
    Potential Problems
  3. Check or uncheck the items you want to include or exclude from the Code Analyzer examination.
    • Detect components having no 'Option Explicit': use this option to report all the components that do not have the Option Explicit statement included in the declaration area.
    • Detect optional parameters with no default value specified: check this option to report all the optional parameters that do not have a default value. Besides certain problems that may arise from this situation, it is also a VB.NET known incompatibility.
    • Detect possible collection enumerator (NewEnum) with wrong DispID: check this option to detect possible collection enumerator implementations that have a wrong DispID. If you have encountered situations when a For Each... enumeration simply refused to work on a custom collection then you will surely appreciate this feature.
    • Look for members with no error handler: use this option to detect all the procedures that do not have an active error handler. You may also skip from reporting methods that are labeled with the CodeSMART 'CSEH: Skip comment.
    • Report occurrences of the 'On Error GoTo 0' statement: the On Error GoTo 0 statement can be very dangerous since it turns off error handling when issued in a procedure. Check this option to detect the presence of this statement in your code. Additionally, you may instruct CodeSMART to not report methods that are labeled with the CodeSMART 'CSEH: Skip comment.
    • Report 'Terminate'/'Resize' events with no 'On Error Resume Next' statement: the Terminate/Resize events should use the On Error Resume Next statement (for the Terminate event this is mandatory, while for Resize it's just a recommendation). Check this option in order to report all implementations of these two events in your code that do not have this type of error handler.
    • Look for variant variables, functions and member parameters: check this option to report variant variables, functions and procedure parameters used in your code. Besides poor speed and certain problems that may arise from using variants, it is also a VB.NET known incompatibility.
    • Do not report constructs that are explicitly declared "As Variant": Check this option if you don't want variables, functions and member parameters, explicitly declared As Variant to be reported in the conditions of the above option.
    • Detect and report variables not initialized before use: check this option to obtain a list with all the variables that are not explicitly initialized before use. This option is useful when you know you have variables that must be initialized with certain values before their usage.
    • Detect functions with no return values: check this option to get a list with all the function that do not seem to return any value. The Code Analyzer will search inside the body of a particular function for its name as a left value expression.
  4. Click OK to make the changes permanent.
See also
Code Analyzer Overview
Dead Code Detection
Slow Code Detection
Collection Classes Options
Other Options
Analyzing Code

Back To Top

Copyright © 2008 AxTools - CodeSMART 2007 for VB6 - Code Analyzer