Project NameCheck configuration
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.
Setting | Page | Use |
---|---|---|
Check variables | Misc | With this dropdown you can enable or disable variable and array name verification. |
Check parameters | Misc | With this dropdown you can enable or disable parameter name verification independently of other variables. |
Scope prefix/suffix | Scopes | Configure the scope prefixes (or suffixes) if you plan to use them. |
Type prefix/suffix | Types | Configure a type prefix or suffix for each data type you have. |
Require ProperCase | Misc | When 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 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.
Setting | Page | Use |
---|---|---|
Check constants | Misc | With this dropdown you can enable or disable constant name verification. |
Ignore scope of constants | Misc | Enable this option if there is no scope prefix/suffix for constants. |
Constants in ALL_CAPS | Misc | Enable this option if constants names must be in upper case, with the exception of any prefixes/suffixes. |
Require ProperCase | Misc | If 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/suffix | Special | If all constants must have a common prefix (or suffix) such as "c", use this option. |
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.
Setting | Page | Use |
---|---|---|
Check functions | Misc | With this dropdown you can enable or disable function name verification. |
Check subs | Misc | With this dropdown you can enable or disable sub name verification. |
Check property procedures | Misc | With this dropdown you can enable or disable property name verification. |
Scope prefix/suffix | Scopes | Configure the scope prefixes (or suffixes) if you plan to use them. |
Type prefix/suffix | Types | Configure a type prefix or suffix for each data type you have. These settings affect functions and properties, but not subs. |
Require ProperCase | Misc | When 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 can be treated just like normal variables. You can optionally use special settings for array data types.
Setting | Page | Use |
---|---|---|
Ignore type of arrays | Misc | Enable this option if the data type of arrays should have no effect on their names. |
Array prefix/suffix | Special | If all arrays must have a common prefix (or suffix) such as "a", use this option. |
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.
Setting | Page | Use |
---|---|---|
Check controls | Misc | With this dropdown you can enable or disable control name verification. |
Control type prefix/suffix | Controls | Use the Controls tab to set a specific prefix (or suffix) for each control class. These settings also affect control pointer variables. |
Control pointer prefix/suffix | Special | A 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 cumulative | Misc | Enable 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. |
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.
Setting | Page | Use |
---|---|---|
Check module names | Misc | With this dropdown you can enable or disable module name verification. |
Module prefix/suffix | Modules | Use 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.
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).
Setting | Page | Use |
---|---|---|
Check Types and Enums | Misc | With this dropdown you can enable or disable UDT name verification. |
Ignore scope of Type/Enum | Misc | Enable this option if there is no scope prefix/suffix for UDTs (and Enums). |
Type name prefix/suffix | Special | Use 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/suffix | Scopes | Use 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/suffix | Types | Use 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.
Structures in .NET are handled the same way as any modules. It is not possible to require a scope prefix/suffix for Structures.
Setting | Page | Use |
---|---|---|
Check module names | Misc | With this dropdown you can enable or disable module name verification, including Structure names. |
Structure prefix/suffix | Modules | Use the Modules tab to set a specific prefix (such as "S") or suffix for Structure names. |
Default Structure record prefix/suffix | Types | Use 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 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.
Setting | Page | Use |
---|---|---|
Check Types and Enums | Misc | With this dropdown you can enable or disable Enum name verification. |
Ignore scope of Type/Enum | Misc | Enable this option if there is no scope prefix/suffix Enums (and UDTs in VB 3-6). |
Enum name prefix/suffix | Special | Use 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/suffix | Scopes | Use 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/suffix | Types | Use 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.
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