|
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.
Sections:
CONV1-Ordinary types that do not start with "T" CONV2-Exception types that do not start with "E" CONV3-Pointer types that do not start with "P" CONV4-Interface types that do not start with "I" CONV5-Class fields that are not declared in the private section
CONV6-Class fields that are exposed by properties (read/write) but do not start with "F" CONV7-Properties to method pointers that do not start with "On/Before/After" CONV8-Functions that are exposed by properties (read) but do not start with "Get" CONV9-Procedures that are exposed by properties (write) but do not start with "Set" CONV10-Classes that have visible constructors with bad names
CONV11-Classes that have visible destructors with bad names CONV12-Identifiers that have unsuitable names CONV13-Multiple with-variables CONV14-Property access methods that are not private/protected CONV15-Hard to read identifier names
CONV17-Bad class visibility order CONV18-Identifiers with numerals CONV19-Local identifiers that "shadow" outer scope identifiers CONV20-Local identifiers that "shadow" class members
CONV21-Class/member name collision CONV22-Class fields that are not declared in the private/protected sections CONV23-Class fields that do not start with "F" CONV24-Value parameters that do not start with selected prefix CONV25-Const parameters that do not start with selected prefix
CONV26-Out parameters that do not start with selected prefix CONV27-Var parameters that do not start with selected prefix CONV28-Old-style function result CONV30-Private can be changed to strict private
CONV31-Protected can be changed to strict protected CONV32-Multiple statements on the same line
CONV1-Ordinary types that do not start with "T"
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”.
Also custom attributes inheriting from TCustomAttribute are not reported.
__________________________________________________
CONV2-Exception types that do not start with "E"
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”.
__________________________________________________
CONV3-Pointer types that do not start with "P"
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”.
__________________________________________________
CONV4-Interface types that do not start with "I"
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”.
__________________________________________________
CONV5-Class fields that are not declared in the private section
This is a list of all class fields that are not declared in the private section of a class.
__________________________________________________
CONV6-Class fields that are exposed by properties (read/write) but do not start with "F"
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”.
This section is similar to CONV23, but that section reports all fields, not only those exposed as properties.
__________________________________________________
CONV7-Properties to method pointers that do not start with "On/Before/After"
This is a list of all properties to method pointers that do not start with "On/Before/After"
__________________________________________________
CONV8-Functions that are exposed by properties (read) but do not start with "Get"
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).
__________________________________________________
CONV9-Procedures that are exposed by properties (write) but do not start with "Set"
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).
__________________________________________________
CONV10-Classes that have visible constructors with bad names
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”.
__________________________________________________
CONV11-Classes that have visible destructors with bad names
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”.
__________________________________________________
CONV12-Identifiers that have unsuitable names
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”).
__________________________________________________
CONV13-Multiple with-variables 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.
__________________________________________________
CONV14-Property access methods that are not private/protected 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.
__________________________________________________
CONV15-Hard to read identifier names
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”.
__________________________________________________
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.
__________________________________________________
CONV17-Bad class visibility order
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.
__________________________________________________
CONV18-Identifiers with numerals
This list contains all identifiers with names that contain numerals.
__________________________________________________
CONV19-Local identifiers that "shadow" outer scope identifiers
This list contains local identifiers that have the same name as outer scope identifiers in the same unit.
Example:
Although this is allowed, it may lead to confusion and misunderstandings when maintaining the code.
__________________________________________________
CONV20-Local identifiers that "shadow" class members
This list contains local identifiers in methods that have the same name as a class member.
Example:
Although this is allowed, it may lead to confusion and misunderstandings when maintaining the code.
__________________________________________________
CONV21-Class/member name collision
This section reports situations where class and member names collide.
__________________________________________________
CONV22-Class fields that are not declared in the private/protected sections
This is a list of all class fields that are not declared in the private/protected sections of a class. Fields should normally not be made "public". They should instead be accessed through properties
__________________________________________________
CONV23-Class fields that do not start with "F"
This is a list of all class fields that not start with the letter “F”. As a convention, private class field names start with the letter “F”. Component fields in the DFM-file are not reported.
This section is similar to CONV6, but that section only reports field exposed as properties.
__________________________________________________
CONV24-Value parameters that do not start with selected prefix
This is a list of all value parameters that do not start with the selected prefix. Set the prefix in the Reports tab page for the project. Double-click on the Convention Report, select report section CONV24 and press the Prefix button to enter the prefix.
__________________________________________________
CONV25-Const parameters that do not start with selected prefix
This is a list of all const parameters that do not start with the selected prefix. Set the prefix in the Reports tab page for the project. Double-click on the Convention Report, select report section CONV25 and press the Prefix button to enter the prefix.
__________________________________________________
CONV26-Out parameters that do not start with selected prefix
This is a list of all out parameters that do not start with the selected prefix. Set the prefix in the Reports tab page for the project. Double-click on the Convention Report, select report section CONV26 and press the Prefix button to enter the prefix.
__________________________________________________
CONV27-Var parameters that do not start with selected prefix
This is a list of all var parameters that do not start with the selected prefix. Set the prefix in the Reports tab page for the project. Double-click on the Convention Report, select report section CONV27 and press the Prefix button to enter the prefix.
__________________________________________________
CONV28-Old-style function result
This is a list of functions where instead of "Result", the function name is used as the result variable.
__________________________________________________
This is a list of locations where "with" is used.
__________________________________________________
CONV30-Private can be changed to strict private
This is a list of class members that are private but can be changed to strict private.
__________________________________________________
CONV31-Protected can be changed to strict protected
This is a list of class members that are protected but can be changed to strict protected.
__________________________________________________
CONV32-Multiple statements on the same line
This is a list of location where there are more than one statement on the same line.
See also:
|