Delphi-RAG-Lint

drag-lint help

extract-method and create-enum-helper through the compile gate by default

Since: 1.52.0-alpha

extract-method / create-enum-helper --apply build the project before and after the write; no project found = REFUSED, --no-compile-gate writes unbuilt.

Read this when extract-method or create-enum-helper refuses with REFUSED (no-project) or (dirty-baseline), or when you want to know which project they build. Since 1.52 --apply goes through the compile gate without --project: the project is --project, else the project a DB at <dir>\_D-RAG\<base>.sqlite belongs to, else the nearest .dproj (walking up from the unit's folder) whose .dproj / .dpr names the unit. A project that does not build is refused; a fix that breaks the build is rolled back. No project = refused (exit 2).

How to run it

drag-lint extract-method --in <F> --from-line <L1> --to-line <L2> --name <N> [--json|--apply|--no-backup] [--no-compile-gate] [--project <X.dproj> [--platform <p>] [--rsvars <bat>] [--build-timeout <s>]] - pull a statement run into a new method

Example:

drag-lint extract-method --in <F> --from-line <L1> --to-line <L2> --name <N> --apply

Full flag list: extract-method in the CLI reference.

drag-lint create-enum-helper --qname <TEnum> --db <db> --apply [--project <X.dproj> | --no-compile-gate] [--platform <p>] [--rsvars <bat>] [--build-timeout <s>] [--no-backup]

Example:

drag-lint create-enum-helper --qname <TEnum> --db <db> --apply

Full flag list: create-enum-helper in the CLI reference.

Flags

FlagArgumentMeaningDefault
--apply
--project<X.dproj>
--no-compile-gate
--apply
--project<X.dproj>
--no-compile-gate

Where to click

No IDE surface: this feature runs from the CLI (see How to run it).

Details

Since 1.52 extract-method --apply and create-enum-helper --apply build the project before and after they write, without --project on the command line. Before 1.52 they built only when --project was given; without it they wrote unbuilt.

Which project is built

The first that applies:

  1. --project <X.dproj>.
  2. The database's own project: a DB at <dir>\_D-RAG\<base>.sqlite belongs to <dir>\<base>.dproj when that file exists (the IDE passes --db only).
  3. The project that names the unit: walking up from the edited unit's folder, the one .dproj whose text, or whose .dpr / .dpk, names the unit's file.

stderr names the project and how it was found:

extract-method: note: --apply writes through the compile gate of App.dproj (the project that names Foo.pas; --no-compile-gate writes unbuilt)

What the gate does

  • Build 1 fails: REFUSED (dirty-baseline), exit 1, nothing written.
  • Build 2 fails (the fix broke the build): every file is rolled back, exit 1.
  • Both build: the files stay written (with .BCK<n> backups unless --no-backup), exit 0.

No project found

REFUSED (no-project): extract-method --apply: no project builds C:\x\Foo.pas -- pass --project <X.dproj>, or --no-compile-gate to write unbuilt; nothing written

Exit 2. The same refusal is given when the nearest folder holds two or more projects that name the unit (pass --project to choose one).

Writing without a build

--no-compile-gate writes unbuilt, as before 1.52, and says so on stderr.

Limits

The unit is matched to a project by FILE NAME in the project text, so a same-named unit in another folder can match. The gate then builds a project the edit does not reach; it still refuses a project that does not build.

Runner: tests\autotest\run_v152_GATE2_fixers.ps1.

1.52 follow-ups (BK-GATE)

  • lint --fix --apply --db <db> on a unit that no project builds is refused like the two verbs above: REFUSED (no-project), exit 2, nothing written (owner ruling 2026-11-18). With --db the project is the DB's own project or the one that names the unit; --no-compile-gate writes unbuilt. A loose file with no --db is unchanged.
  • extract-method --apply listens for drag-lint shutdown --db <db>: the after-build is stopped, the files are rolled back, exit 1 (as narrow-param and create-enum-helper).
  • A gated write says .BCK backup written (the gate keeps .BCK<n> copies), not .bak written.
  • The IDE's Rename Symbol and Extract Method apply spawn gets a 300 s stall budget (a preview keeps 60 s); the gate builds the project twice, baseline and after, by design.

Runner: tests\autotest\run_v152_BK-GATE.ps1.


All features | CLI reference | IDE menus