Project NameCheck standard configuration: Practical issues

Project NameCheck configuration

Variables

Variables are probably the most usual names to have standards for. It makes sense to start by configuring variable naming standards first. Arrays and parameters are treated as variables unless otherwise mentioned.

SettingPageUse
Check variablesMiscWith this dropdown you can enable or disable variable and array name verification.
Check parametersMiscWith this dropdown you can enable or disable parameter name verification independently of other variables.
Scope prefix/suffixScopesConfigure the scope prefixes (or suffixes) if you plan to use them.
Type prefix/suffixTypesConfigure a type prefix or suffix for each data type you have.
Require ProperCaseMiscWhen on, the first letter after any prefix must be in upper case. When off, there are no casing requirements.

There are special options for arrays and also for variables that contain controls, objects, forms, enum values or user-defined types. You can read more about them later on this page.

Constants

Constants are a special case in that they have special options. Constant names are not affected by the data type of the constant. You can optionally set a special prefix for all constants, ignore scope and require ALL_CAPS.

SettingPageUse
Check constantsMiscWith this dropdown you can enable or disable constant name verification.
Ignore scope of constantsMiscEnable this option if there is no scope prefix/suffix for constants.
Constants in ALL_CAPSMiscEnable this option if constants names must be in upper case, with the exception of any prefixes/suffixes.
Require ProperCaseMiscIf the ALL_CAPS setting is off, the ProperCase setting is in effect. When on, the first letter after any prefix must be in upper case. When off, there is no casing requirement for constants.
Constant prefix/suffixSpecialIf all constants must have a common prefix (or suffix) such as "c", use this option.

Procedures (Subs, Functions, Properties)

Naming standards enforcement is possible for the following types of procedures: subs, functions and properties. Names of DLL procedures, Events, Event handlers,

The data type of a function is the data type of its return value. The data type of a property is the data type it stores and/or returns.

SettingPageUse
Check functionsMiscWith this dropdown you can enable or disable function name verification.
Check subsMiscWith this dropdown you can enable or disable sub name verification.
Check property proceduresMiscWith this dropdown you can enable or disable property name verification.
Scope prefix/suffixScopesConfigure the scope prefixes (or suffixes) if you plan to use them.
Type prefix/suffixTypesConfigure a type prefix or suffix for each data type you have. These settings affect functions and properties, but not subs.
Require ProperCaseMiscWhen on, the first letter after any prefix must be in upper case. When off, there are no casing requirements.

There are special options for functions and properties whose data type is an array, control, object, form, enum values or user-defined type. You can read more about them later on this page.

Arrays

Arrays can be treated just like normal variables. You can optionally use special settings for array data types.

SettingPageUse
Ignore type of arraysMiscEnable this option if the data type of arrays should have no effect on their names.
Array prefix/suffixSpecialIf all arrays must have a common prefix (or suffix) such as "a", use this option.

More about array settings

Controls

With controls we mean controls placed on VB 3-6 forms. Object variables having a control data type are treated as control pointers. In VB.NET, controls are always treated as normal variables.

SettingPageUse
Check controlsMiscWith this dropdown you can enable or disable control name verification.
Control type prefix/suffixControlsUse the Controls tab to set a specific prefix (or suffix) for each control class. These settings also affect control pointer variables.
Control pointer prefix/suffixSpecialA control pointer is an object variable of a control data type. You can require a specific prefix (or suffix) such as "p" or "ptr" to be embedded in a control pointer name. Control pointer settings
Menu names must be cumulativeMiscEnable this option to require that names of menu items must start with the name of the menu they are in. Thus, the Save command in menu mFile must start with mFile. mFileSave would be OK.

Module names

You can enforce naming standards on the names of modules, forms, classes, interfaces, .NET structures, namespaces etc. You cannot enforce standards on physical file names, though.

SettingPageUse
Check module namesMiscWith this dropdown you can enable or disable module name verification.
Module prefix/suffixModulesUse the Modules tab to set a specific prefix (or suffix) for each type of module. In VB 3-6, these settings also affect object variables declared as Form, UserControl etc.

Module names have no scope prefix/suffix, only those prefixes/suffixes defined on the Modules tab apply. There are no options for class inheritance either. You cannot define a child class prefix based on the ancestor classes.

Types (user-defined types, UDTs in VB 3-6)

User-defined types (UDTs) are difficult to configure especially as there are several things to consider: the name of the UDTs, the name of their fields and the name of variables and functions that use the UDTs as their data type. The following settings apply to UDTs (Type blocks) in VB 3-6. Read below for .NET Structures.

Here we use here the acronym UDT for clarity. A UDT name is the name of the Type block (Type TPerson). A UDT field is a field definition within the block (Name As String). A UDT variable is a variable having the UDT as its data type (Dim Boss As TPerson).

SettingPageUse
Check Types and EnumsMiscWith this dropdown you can enable or disable UDT name verification.
Ignore scope of Type/EnumMiscEnable this option if there is no scope prefix/suffix for UDTs (and Enums).
Type name prefix/suffixSpecialUse this setting to require a special prefix (such as "T") or suffix (such as "_type") on all UDT names. Leave empty if UDT names have no specific prefix/suffix.
Type field prefix/suffixScopesUse this setting to require a special scope prefix (such as "fld") or suffix on all UDT fields. Leave empty if field names only have a data type prefix/suffix ("str", "int", "$" etc.), or no prefix/suffix at all.
Default Type record prefix/suffixTypesUse this setting to require a special prefix (such as "udt") or suffix on all UDT variables. Also affects functions that return a UDT as their return value.

You can override the "Default Type record prefix/suffix" setting by creating a new prefix/suffix for each UDT. If you want variables declared As TPerson be prefixed with "pers", add a TPerson prefix on the Types tab.

.NET Structures

Structures in .NET are handled the same way as any modules. It is not possible to require a scope prefix/suffix for Structures.

SettingPageUse
Check module namesMiscWith this dropdown you can enable or disable module name verification, including Structure names.
Structure prefix/suffixModulesUse the Modules tab to set a specific prefix (such as "S") or suffix for Structure names.
Default Structure record prefix/suffixTypesUse this setting to require a special prefix (such as "udt") or suffix on all Structure variables. Also affects functions that return a Structure as their return value.

You can override the "Default Structure record prefix/suffix" setting by creating a new prefix/suffix for each Structure name. If you want variables declared As SPerson be prefixed with "pers", add a SPerson prefix on the Types tab.

Structure fields are normal variables, so your normal variable settings apply. Note that in a Structure, a Dim statement has Public scope.

Enums

Enums are difficult to configure especially as there are several things to consider: the name of the Enums (Enum blocks), the name of the Enum constants (defined within the enum) and the name of variables and functions that use the Enum as their data type.

Notice that it is not possible to have a data type prefix/suffix on Enum constants.

SettingPageUse
Check Types and EnumsMiscWith this dropdown you can enable or disable Enum name verification.
Ignore scope of Type/EnumMiscEnable this option if there is no scope prefix/suffix Enums (and UDTs in VB 3-6).
Enum name prefix/suffixSpecialUse this setting to require a special prefix (such as "E") or suffix (such as "_enum") on all Enum names. Leave empty if Enum names have no specific prefix/suffix.
Enum constant prefix/suffixScopesUse this setting to require a special scope prefix (such as "ec") or suffix on all Enum constants. Leave empty if Enum constant names have no prefix/suffix at all.
Default Enum type prefix/suffixTypesUse this setting to require a special prefix (such as "enum") or suffix on all Enum variables. Also affects functions that return an Enum as their return value.

You can override the "Default Enum type prefix/suffix" setting by creating a new prefix/suffix for each Enum. If you want variables declared As EWinVersion be prefixed with "wv", add an EWinVersion prefix on the Types tab.

Practical examples for Types and Enums

Type TPerson
   fldName As String
   fldTitle As String
End Type
Dim udtBoss As TPerson   

Enum EAge
   enYoung
   enOld
End Enum
Dim enumBossesAge As EAge
Name in sample code Setting Tab Prefix used
TPerson Type Special T
fldName, fldTitle Type field Scope fld
udtBoss Default Type record Type udt
EAge Enum Special E
enYoung, enOld Enum constant Scope en
enumBossesAge Default Enum type Type enum

You could even have special settings for variables of TPerson and EAge on tab Type. This way, you could require that all variables of TPerson start with "pers" and all variables of EAge start with "ag", like this:

Dim persBoss As TPerson
Dim agBoss As EAge

Project NameCheck configuration

©Aivosto Oy - Project Analyzer Help Contents