All Downloads are FREE. Search and download functionalities are using the official Maven repository.

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:

  1. strict private
  2. private
  3. strict protected
  4. protected
  5. public
  6. 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