Repository navigation
heavy initialization
An initialization section reaches the file system, the registry, the network, a database or a dialog. That work runs before the application has an exception handler or a window, and every process that links the unit pays for it at start, including a test runner. ON by default in lint-all and lint-project.
drag-lint lint-all --db <project.sqlite> --rule heavy-initialization
drag-lint lint-project --db <project.sqlite> --rule heavy-initialization
It needs an index that has resolved references to sections (1.44 or later).
One hint per section, at the call or reference in the section that starts the first path. The message names each category and a routine that shows it.
The section's own references and those of every routine it reaches count when they name:
- file system:
TFile,TDirectory,TStreamWriter,TFileStream,TIniFile,TMemIniFile, a bareAssignFile,Rewrite,ResetorFindFirst, a memberLoadFromFileorSaveToFile; - registry:
TRegistry,TRegistryIniFile; - network:
THTTPClient,TIdHTTP,TNetHTTPClient,TIdTCPClient; - database: a member
ExecSQL,StartTransaction,CommitorRollback; - dialog:
ShowMessage,MessageDlg,MessageBox,InputBox.
A reached routine also counts through its stored facts: touches for the registry, the network and transactions, sql_reads and sql_writes for a database.
-
TPath: it computes strings. - A closure the section only passes, such as a registration: the body of an anonymous method is not walked.
- A call through virtual dispatch, a callback or a library routine, and a call the index resolved only as ambiguous.
- A
finalizationsection.
A path behind an if still counts: the index has no branch conditions, so a section that only logs on failure is reported.