Delphi-RAG-Lint
← DL (drag-lint) · Change safely

Know what breaks before you change it.

Big Delphi projects get changed carefully, or not at all. DL shows the blast radius of a change before you make it, untangles units that use each other, finds what can go, and makes the edits itself, with the compiler checking each one.

01 — Impact

What would this change touch?

DL change-impact chart

Impact before you change

Everything a change to one symbol reaches: the code to retest.

Impact help →

impact reports what would be affected if a symbol changes: the set of code to retest. impact --all-projects does it over every project you have indexed, with a row for each part it could not answer rather than a silent gap. call-path finds the shortest resolved call path from one routine to another, and the butterfly chart shows a routine’s callers and callees in one picture.

After the change, compare reruns a saved report and shows before, delta and after, and diff compares two index snapshots, say from before and after a refactoring.

call-path · butterfly · compare · diff

02 — Units

Untangle circular units

DL graph of the units that use a unit

Who uses this unit

The units that use a unit, as a graph.

Graph viewer →
DL unit dependency chart

Dependencies

What depends on what, as a chart and as text.

Dependency report →

cycles finds the uses cycles among your units. --hub names the units whose removal leaves a cycle group acyclic, with the edges and references on each side. --plan writes a mechanical refactoring playbook, and cycles --fix applies one group’s fix through the compile gate, re-indexes and checks the result against what the plan predicted.

Libraries that ship without source still count: uses-recover reads the vendor’s .hpp headers so the graph sees through them, and it never reads a .dcu.

Circular uses report · Cycles fix · uses-recover · Article: untangling circular uses

03 — Clean up

Dead code and unused uses

Find Dead Code scans the whole project for code nothing references, not one file at a time. The uses audit shows, for one unit, which entries can move from the interface section to the implementation section and which are not needed at all; the cleanup preview proves each removal by compiling. safe-delete deletes a symbol if, and only if, the index finds no reference to it.

Find Dead Code · Uses audit · Uses cleanup preview · safe-delete

04 — Refactor

Refactorings with proof

Rename. Rename Symbol renames across the whole project and proves every occurrence; what it cannot prove, it refuses. An event handler’s binding in the form file is renamed with it. A unit that several projects compile is renamed in every one of them, or in none.

Restructure. extract-method pulls a run of statements into a new method. Extract Interface declares an interface from the members of a class that the project actually uses. unwith removes with blocks, proving every name still binds to what it bound before. Narrow Parameter retypes a class-typed parameter to the most general ancestor that still declares every member the routine uses. Extract Constant turns a literal into a named constant.

Rename Symbol · Rename across projects · extract-method · Extract interface · unwith · Narrow parameter · Extract constant

05 — The compiler as referee

Built, checked, or rolled back

The compile gate is how DL stays honest: it builds, makes the edit, builds again and rolls the edit back if the compiler reports a new error. Rename, cycle fixes, extract interface, narrow parameter and lint --fix all go through it.

ghost-check compiles the project with your unsaved editor buffers temporarily in place of the files, then restores the files unchanged, so you know before you save. Compile Dependents checks the units that depend on the one you are editing.

Component conversion. Conversion rules move forms and units from an old component to its replacement: the form file, the declarations and the uses clauses together, with a preview first. In the form designer, select the components and choose drag-lint > Convert Components.

ghost-check · Compile Dependents · convert-apply · Convert Components

06 — Charts

Charts and reports

Dependencies, call butterflies, layer diagrams and change impact come as charts and as text. The Reports submenu in RAD Studio and drag-lint ask answer the same chart questions, and a row in a chart opens its line in RAD Studio. Since 1.60 the IDE shows each chart as a tab of a dockable drag-lint Chart window; without the Microsoft Edge WebView2 Runtime it opens in the browser as before.

Chart questions · Layer diagram · Graph viewer · drag-lint Chart window

We lean on these refactorings to keep HTR Micronite, our own large Delphi application, moving, so they had to be safe there first.