Delphi-RAG-Lint

drag-lint help

Reconcile Project Members (.dpr/.dproj)

Since: 1.18.0-alpha

Lists every unit a project uses that is neither a project member nor in the library, judges each one (project unit or third-party) and fixes it either way.

Read this after moving or adding units by hand, or when lint reports unit-not-in-dpr or unit-not-in-library. It lists every unit the project compiles that is neither in the .dpr/.dproj nor in the library, judges each by the project's own roots (inside = a missed project unit, outside = third-party), and offers two fixes: --apply adds the unit to the project (the default), --apply --to library adds its folder to the library. Without --apply it only reports.

How to run it

Full flag list: reconcile-project in the CLI reference.

Flags

FlagArgumentMeaningDefault
--apply
--toproject|library
--only<unit,...>
--db<db>
--full
--json
--config<path>

Where to click

  • RAD Studio main menu: drag-lint > Uses & Dependencies > Reconcile Project Members (.dpr/.dproj)...
    1. Open the project in RAD Studio
    2. Choose drag-lint > Uses & Dependencies > Reconcile Project Members (.dpr/.dproj)...
    3. Read the MISSING list: each unit is marked [project unit -> --apply] or [third-party -> library: --apply --to library]; units already in the library are not listed
    4. Copy a command from SUGGESTED FIXES -- each is pre-narrowed with --only to the units its fix suits; nothing is written until you apply
    5. From a shell: drag-lint reconcile-project <App.dpr|.dproj> [--apply] [--to project|library] [--only <unit,...>]

Details

Lists every unit a project uses that is neither a project member (in the .dpr / .dproj) nor in the library, says whose unit each one is, and fixes it one of two ways. It can also re-scan and recompile every member to heal the index and findings. Reach for it after moving or adding units by hand, or when lint reports unit-not-in-dpr or unit-not-in-library.

Running it from the CLI

drag-lint reconcile-project <App.dpr|.dproj> [--apply] [--to project|library] [--only <unit,...>] [--db <db>] [--full] [--json] [--config <path>]

Without --apply the command only reports. --only narrows MISSING (and so what --apply writes) to the units you name. --db also heals the index and findings for every project member (re-scan + recompile) without editing the .dpr; --full forces the recompile even when nothing looks incoherent.

Project unit or library unit

A unit counts as in the library when it sits under a registry library path (the IDE's Library path) or under a folder that the manifest's library section ("source": "registry-libraries" in drag-lint.json) lists in "include". Such units are never listed.

Every other MISSING unit gets a verdict from the project's own roots (the ownRoots in <project>\_D-RAG\drag-lint-project.json, or else the project folder):

VerdictWhere the unit isSuggested fix
project unitunder the own roots -- your own code, just not listed--apply: add it to the .dpr and .dproj (the default)
third-partyoutside the own roots -- a vendor or framework folder--apply --to library: add its folder to the library section's "include"

Both fixes are always open to you; the verdict is a recommendation. The text report marks each line ([project unit -> --apply] or [third-party -> library: --apply --to library]) and ends with a SUGGESTED FIXES block: one command per fix, already narrowed with --only to the units that suit it. --json gives each MISSING item owner, suggestedFix and folder; a {$I} include is reported with owner include and suggestedFix none, never as a fix target. A listed unit under a library root is not an EXTRA.

--apply --to library edits the manifest named by --config, or else the drag-lint.json beside the exe. It writes <manifest>.bak first and keeps every key it does not model. If a dll-win32 / dll-win64 twin exists, it copies the result there too. The project files are not touched. The next index --all walks the new folder as a library root on every platform the section targets, and the next reconcile no longer lists those units.

In lint-all

unit-not-in-library (project-wide, on by default) reports each third-party unit that is neither a member nor in the library, using the same analysis. Units under the own roots are unit-not-in-dpr's job (its third direction), so each unit is reported exactly once.

drag-lint lint-all --db <db> --project <App.dproj> --rule unit-not-in-library

Since 1.51 unit-not-in-dpr also reports a project-local unit that no uses clause reaches but the program still links: a closure .dfm streams a class only that unit declares (the finding is anchored on the .dfm line), code names it qualified (Unit.Ident, string literals ignored), or GetClass / FindClass('TName') looks its class up by name. A unit with none of these links is not reported. The message names the uses and project entries to add.

drag-lint lint-all --db <db> --project <App.dproj> --rule unit-not-in-dpr

index --project <App.dproj> reports the same gap at index time: it prints one unit-not-in-dpr: line per compile-closure unit the .dpr / .dproj does not list, and --exclude-under no longer drops such a unit (it prunes library walks only and names the kept files). The fix is this verb's --apply, or an edit by hand.

What it needs

Optional. An index is not required to run this command, but pass --db to also heal the index and findings for the project's members.

Example

Illustrative only:

drag-lint reconcile-project C:\Projects\MyApp\Tests\MyAppTests.dproj

A test project that compiles ..\..\COMMON\FlexDateTime.pas (inside the declared own roots) and C:\Projects\DUnitX\Source\DUnitX.TestFramework.pas (outside them) would show FlexDateTime as a project unit (--only FlexDateTime --apply) and DUnitX.TestFramework as third-party (--only DUnitX.TestFramework,... --apply --to library).


All features | CLI reference | IDE menus