Delphi-RAG-Lint

drag-lint help

Speculative generality (lint rule)

Since: 1.62.0-alpha

Project rule, OFF by default: an interface with one implementor or a class with one direct descendant in the index (G-59).

Read this to see what speculative-generality reports, why a heir outside the index is not seen, and how to review a finding. It runs in lint-all and lint-project over a project index.

How to run it

drag-lint lint-all [--profile <name>] [--target-compiler <ver|auto>] [--db <file.sqlite>] [--project <.dproj>] [--build-config <name>] [--rule <id>[,<id>...]] [--disable id,...] [--output <report.txt>] [--json] [--labels] [--quiet] [--lint-third-party] [--no-preprocess] [--shared-db <db> ...] [--library-db none] [--no-budget] [--changed-since <rev>]

Example:

drag-lint lint-all --db <project.sqlite> --rule speculative-generality

Full flag list: lint-all in the CLI reference.

Where to click

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

Details

Two rules promoted from sections of the metrics verb, and one summary line of lint-all (1.62, lane Q2RULES, gap-plan rows G-58, G-59, G-52). Both rules are project-wide, severity hint, and OFF by default (owner ruling Q162-7: smells ship OFF).

Running them

drag-lint lint-all --db <project.sqlite> --rule data-clump
drag-lint lint-all --db <project.sqlite> --rule speculative-generality
drag-lint lint-all --db <project.sqlite> --enable data-clump,speculative-generality

Or opt in per project with "enabled": ["data-clump", "speculative-generality"] in drag-lint-lint.json. A plain lint-all runs neither.

data-clump (G-58)

The same group of three or more parameters (name AND type) travels together through three or more differently named routines. The rule asks the same reader as drag-lint metrics (LoadMetrics), so the metrics "repeated parameter groups" section and the rule never disagree: same thresholds, same counting (overloads, overrides and a declaration with its implementation count once; a routine contributes its first 12 sorted parameters).

One finding per group, anchored at the first routine of the group (alphabetical by qualified name); the message lists the parameters and up to five routines. Fix: introduce a record or class for the group. Review: a dl:ok data-clump marker on the anchored routine's line reviews the whole group.

Not a clump: two shared parameters; overloads of one name; the same names with a different type in one routine.

speculative-generality (G-59)

An interface with exactly one implementor, or a class with exactly one direct descendant, counted inside the index. One finding per base type, anchored at its declaration; the message names the single heir.

Limits, stated: only ancestor references the index resolved are counted, so a heir in a unit outside the index is not seen (that is why the rule is a hint and OFF by default); an interface with NO implementor is not reported (it is another rule's business); a second implementor that is yet to come or a test double is a reason for a dl:ok review, not a defect of the rule.

Estimated repair time (G-52)

lint-all prints one extra line after its summary (text output only; never under --json, --format json or SARIF):

lint-all: estimated repair time ~35 min over 3 finding(s); largest share 20 min in <file> (per-rule minute ESTIMATES, not a measurement)

The number is the sum, over the findings of the run, of a minutes-per-finding table (DRagLint.Lint.RepairTime): an entry per common rule (1 minute for an unused unit in uses, 5 for a missing doc comment, 20 for a god class), and for a rule without an entry a default by severity (error 15, warning 5, info 2, hint 2). The constants are estimates a developer would give for reading, deciding and fixing ONE finding -- a planning aid, never a measurement, and the line says so. No findings (or all of zero estimate) print no line.

Retired: G-65

G-65 (stat-gated-destructive, pattern 3) is retired for good (owner ruling Q162-7, 2026-11-30): the measured population was 0 (PLAN-stat-gated-pattern-3.md, 2026-08-30: "RETIRE IT"). Nothing is built; the gap-report row, the gap-wave plan rows and any backlog or INBOX row are closed as retired, and no registry entry exists for it.

Tests

tests\autotest\run_q2rules.ps1 -- positive fixtures (uClumpPos.pas, uSpecPos.pas) and negative fixtures (uClumpNeg.pas, uSpecNeg.pas) under tests\lint-project\q2rules\; the positive-control runs fail on an engine where the rule is missing or off.


All features | CLI reference | IDE menus