_CONV Convention Compliance Report

Top  Previous  Next

 

Targets: All

 

This report contains several lists with identifiers that do not comply with conventions for naming of identifiers.

 

The choice of names for identifiers has a considerable influence on the ease of understanding and maintenance costs of your source code. Developers familiar with the coding standards can understand the code more easily if it follows general conventions.

 

 

Ordinary types that do not start with "T" (CONV1)

 

This is a list of all ordinary types that do not start with the letter “T”. Exception, pointer and interface types are not included. As a convention, user-defined type names start with the letter “T”. A class that is a CoClass is an exception and is not reported. PAL assumes a CoClass when the name of the class starts with the letters “Co”. Furthermore, the class must have a class function with the name “Create”.

 

__________________________________________________

 

Exception types that do not start with "E" (CONV2)

 

This is a list of all exception types that do not start with the letter “E”. As a convention, user-defined exception type names start with the letter “E”.

 

__________________________________________________

 

Pointer types that do not start with "P" (CONV3)

 

This is a list of all pointer types that do not start with the letter “P”. As a convention, user-defined pointer type names start with the letter “P”.

 

__________________________________________________

 

Interface types that do not start with "I" (CONV4)

 

This is a list of all interface types that do not start with the letter “I”. As a convention, user-defined interface type names start with the letter “I”.

 

__________________________________________________

 

Class fields that are not declared in the private section (CONV5)

 

This is a list of all class fields that are not declared in the private section of a class.

 

__________________________________________________

 

Class fields that are exposed by properties (read/write) but do not start with "F" (CONV6)

 

This is a list of all class fields that are exposed by properties but do not start with the letter “F”. As a convention, private class field names start with the letter “F”.

 

__________________________________________________

 

Properties to method pointers that do not start with "On/Before/After" (CONV7)

 

This is a list of all properties to method pointers that do not start with "On/Before/After"

 

__________________________________________________

 

 

Functions that are exposed by properties (read) but do not start with "Get" (CONV8)

 

This is a list of all functions that are exposed by properties read methods, but do not start with “Get”. As a convention, these functions (methods) should start with the letters “Get” (e g GetIndex, GetBitmap).

 

__________________________________________________

 

Procedures that are exposed by properties (write) but do not start with "Set" (CONV9)

 

This is a list of all functions that are exposed by properties write methods, but do not start with “Set”. As a convention, these procedures (methods) should start with the letters “Set” (e.g. SetIndex, SetBitmap).

 

__________________________________________________

 

Classes that have visible constructors with bad names (CONV10)

 

This is a list of all classes that have constructors with bad names. As a convention, constructor names start with the letters “Create”. For old-style objects (BP7), the constructor names start with the letters “Init”.

 

__________________________________________________

 

Classes that have visible destructors with bad names (CONV11)

 

This is a list of all classes that have destructors with bad names. As a convention, destructor names start with the letters “Destroy”. For

old-style objects (BP7), the destructor names start with the letters “Done”.

 

__________________________________________________

 

Identifiers that have unsuitable names (CONV12)

 

This is a list of all identifiers with names that are the same as directives, e.g. “pascal”, “dynamic”, “index” and others. Even if the compiler allows this, it may lead to misunderstandings. For Delphi 1 and higher, the list also includes identifiers with identical names as identifiers from the System unit (like “Copy”, “AllocMem”).

 

__________________________________________________

 

Multiple with-variables (CONV13)

This is a list of all locations in the source where multiple with-variables (“with A, B do”) are used. It is often considered a bad coding habit to use multiple with-variables, since they make the source more difficult to understand.

 

__________________________________________________

 

Property access methods that are not private/protected (CONV14)

This is a list of all property access methods that are not declared as private/protected. Property access methods are used with properties, e. g:

 

property MyProp : integer read GetMyProp write SetMyProp

 

where GetMyProp and SetMyProp are property access methods.

 

Those methods should not be directly callable from the outside, because all access should go through the associated property.

 

__________________________________________________

 

Hard to read identifier names (CONV15)

 

This is a list of all identfiers with hard to read names. A name is considered hard to read if it contains both the letter “O” and the number”0”, or both the letter “l” and the number “1”.

 

__________________________________________________

 

Label usage (CONV16)

 

This list contains all labels that are used in the source code. Labels define jump-locations for a goto statement. Usage of labels and goto-statements is considered as a bad thing, which is most often not needed in modern object-oriented programming. There are situations though, when a label may be the right choice.

 

__________________________________________________

 

Bad class visibility order (CONV17)

 

This list contains all class types with bad class visibility order in the declaration. Bad order is defined as when private sections appear after public/protected sections or when protected sections appear after public sections. The code is probably easier to understand and maintain if a good visibility order is used.

 

Classes that PAL thinks are derived from TForm are not reported. This is because these type of classes depend on a special order, starting with published identifiers.

 

__________________________________________________

 

Identifiers with numerals (CONV18)

 

This list contains all identfiers with names that contain numerals.

 

__________________________________________________

 

 

Local identifiers that "shadow" outer scope identifiers (CONV19)

 

This list contains local identifiers that have the same name as outer scope identifiers in the same unit.

 

Example:

 

clip0124

 

Although this is allowed, it may lead to confusion and misunderstandings when maintaining the code.

 

__________________________________________________

 

Local identifiers that "shadow" class members (CONV20)

 

This list contains local identifiers in methods that have the same name as a class member.

 

Example:

 

clip0125

 

Although this is allowed, it may lead to confusion and misunderstandings when maintaining the code.

 

__________________________________________________

 

Class/member name collision (CONV21)

 

This section reports situations where class and member names collide.

 

 

See also:

 

R_GEN General Reports