org.sonar.l10n.delphi.rules.community-delphi.VisibilitySectionOrder.html Maven / Gradle / Ivy
The newest version!
Why is this an issue?
In type declarations, visibility specifiers should be declared in ascending order. This aids
readability and preserves a neat and maintainable type API.
Visibility specifiers should follow the following order:
- strict private
- private
- strict protected
- protected
- public
- published
Exceptions
This rule excludes cases where visibility sections declare a member that is used in later
visibility sections, such as the below:
type
TMyType = class(TObject)
public
type
TMyDescendant = class(TObject);
end;
private
procedure DoSecretThing(Obj: TMyDescendant);
public
procedure DoPublicThing(Obj: TMyDescendant);
end;
How to fix it
Reorder the visibility sections within the type declaration into ascending order.
Resources
© 2015 - 2024 Weber Informatics LLC | Privacy Policy