org.sonar.l10n.delphi.rules.community-delphi.MemberDeclarationOrder.html Maven / Gradle / Ivy
Why is this an issue?
For clarity and consistency, visibility sections within the body of a class, interface, or
record declaration should be organized in the following order:
- Field declarations
- Routine declarations
- Property declarations
The Delphi compiler also forbids field declarations from appearing after routine or property
declarations in the same visibility section.
How to fix it
Reorder the offending visibility section into fields, then routines, then properties:
type
TMyType = class(TObject)
private
FMyVar: Integer;
property MyVar: Integer read FMyVar;
procedure DoThing;
procedure DoAnotherThing;
property MyOtherVar: Integer read FMyVar;
end;
type
TMyType = class(TObject)
private
FMyVar: Integer;
procedure DoThing;
procedure DoAnotherThing;
property MyVar: Integer read FMyVar;
property MyOtherVar: Integer read FMyVar;
end;
Resources
© 2015 - 2024 Weber Informatics LLC | Privacy Policy