org.sonar.l10n.delphi.rules.community-delphi.PointerName.html Maven / Gradle / Ivy
Why is this an issue?
Code that follows a consistent naming convention is self-documenting. In Delphi, all pointer names
should be named identically to the dereferenced type, with the type prefix swapped for
P
.
For example, the pointer types for TMyType
, EMyType
, and
IMyType
should be named PMyType
.
Custom prefixes for dereferenced types are also supported, provided they also start with
T
, E
or I
.
For example, the pointer types for TxyMyType
, ExyMyType
, and
IxyMyType
should be named PxyMyType
.
If the dereferenced type is in PascalCase but does not have a valid prefix, the pointer name is
expected to be the same as the type name but with the addition of the prefix P
.
For example:
^MyObject
should be named PMyObject
^MyType
should be named PMyType
Note that pointers to types that do not follow the naming standard are valid as long as they are
in PascalCase with the prefix P
.
For example:
^my_object
will be valid if named PMyObject
^my_object
will not be valid if named Pmy_object
How to fix it
Rename the pointer type to follow the convention.
Resources