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

org.sonar.l10n.delphi.rules.community-delphi.ProjectFileRoutine.html Maven / Gradle / Ivy

The newest version!

Why is this an issue?

The Delphi project file (.dpr) contains the initialization logic for the program. It is partially generated by the IDE, is generally abstracted over by the .dproj file, and is underemphasized in editor tooling.

Use of the project file for complex logic bloats the application entry point, makes the project more difficult to navigate, and reduces visibility.

How to fix it

Move any routines out of the project file and into a separate unit, which you can then reference from the initialization section of the project file:

// MyProject.dpr
// ...
procedure Foo;
begin
  // ...
end;

begin
  Foo;
end.
// MyProject.dpr
// ...
uses MyUnit;

begin
  Foo;
end.

// MyUnit.pas
interface

procedure Foo;

implementation

procedure Foo;
begin
  // ...
end;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy