Lint rules new in 1.65
New lint rules from the 1.65 research wave: bug patterns, thread start, secrets, division-by-zero flow, enum shapes and field-repository drift.
Read this to see what 1.65 added to the rule catalog and which rules are ON by default; the ON ones were measured at 0 findings on three real project copies.
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> --project <App.dproj> --rule fillchar-args-swapped
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule memory-op-count-exceeds-buffer
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule loop-var-too-narrow
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule sql-add-without-clear
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule thread-configured-after-start
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule thread-start-in-constructor
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule waitfor-synchronize-deadlock
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule assign-override-unsafe-cast
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule compare-result-equals-literal
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule waitfor-result-ignored
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule loop-index-exceeds-static-array
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule setfocus-in-formcreate
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule shift-count-out-of-range
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule sizeof-managed-type
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule secret-literal-value
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule catch-all-not-handled
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule division-by-zero-flow
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule enum-raw-literal
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule enum-explicit-values-no-rtti
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule const-group-enum
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-derived-field-editable
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-handler-orphan
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-key-field-drift
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-generator-drift
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-enum-drift
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-displayformat-drift
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-visible-drift
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-field-unused
Full flag list: lint-all in the CLI reference.
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> --project <App.dproj> --rule repo-constraint-without-message
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
1.65 adds 33 lint rules to the catalog. Rules that are ON by default were measured on ORM3 CLIENT, YADF and Loader copies before release: none of them reported anything there. Rules that are OFF need --enable <id> or "enabled" in drag-lint-lint.json. drag-lint rules --json is the authoritative list.
Bug patterns (research wave, RC-A .. RC-D)
| rule | default | reports | fix |
|---|---|---|---|
| fillchar-args-swapped | ON | FillChar(Buf, 0, SizeOf(Buf)) -- count and fill value swapped (CWE-665) | risky |
| memory-op-count-exceeds-buffer | ON | Move / FillChar with a count larger than the known destination size (CWE-787) | |
| loop-var-too-narrow | ON | for b := 0 to List.Count - 1 with a Byte / ShortInt / Word counter (CWE-197) | risky: widen to Integer |
| sql-add-without-clear | OFF | Q.SQL.Add(..) then Open with no SQL.Clear first | |
| thread-configured-after-start | ON | T := TWorker.Create(False); T.Data := D; -- the thread already runs (CWE-362) | |
| thread-start-in-constructor | ON | Start / Resume inside a TThread constructor (AfterConstruction starts it) | |
| waitfor-synchronize-deadlock | OFF | a main-thread WaitFor / Free of a thread whose Execute reaches Synchronize (CWE-833); lint-all only | |
| assign-override-unsafe-cast | ON | an Assign(Source: TPersistent) override with a hard cast and no is test or inherited fallback (CWE-704) | |
| compare-result-equals-literal | ON | CompareStr(A, B) = 1 -- the result is only guaranteed to be < 0, 0 or > 0 | risky |
| waitfor-result-ignored | ON | Event.WaitFor(Timeout) as a bare statement (CWE-252) | |
| loop-index-exceeds-static-array | ON | for I := 0 to 10 do A[I] past the declared bounds of a same-unit static array (CWE-129) | |
| setfocus-in-formcreate | ON | SetFocus in the handler the DFM binds as the form's OnCreate | risky: ActiveControl := X |
| shift-count-out-of-range | ON | X shl 32 on a 32-bit operand, shl 64 on Int64 (CWE-1335) | |
| sizeof-managed-type | ON | SizeOf(S) of a string / dynamic array / interface used as a byte count (CWE-467) |
ignored-must-use-result also covers TryStrToCurr / UInt / UInt64 / Bool / Time, TryEncodeDate / Time, qualified Locate / FindKey / FindField and TDictionary.TryGetValue.
Security and flow (S2a, S2b)
| rule | default | reports |
|---|---|---|
| secret-literal-value | ON | a password / key / token literal in a .pas file (CWE-798) |
| catch-all-not-handled | OFF | on E: Exception do that neither logs, re-raises nor reports (CWE-396) |
| division-by-zero-flow | OFF | X / V, X div V, X mod V where a V := 0 reaches the division on some path (CWE-369) |
Enumerations (ENUMRULES)
| rule | default | reports |
|---|---|---|
| enum-raw-literal | OFF | an enum turned into a char and compared with a char literal, or cast from Ord('A') |
| enum-explicit-values-no-rtti | OFF | an enum with explicit, non-natural values (no RTTI: GetEnumName, published properties) |
| const-group-enum | OFF | an integer type alias with 3+ gapless consts -- an enum in disguise |
Field repository (R3a, R3b)
All OFF, project-wide, silent without a field repository: repo-derived-field-editable, repo-handler-orphan, repo-key-field-drift, repo-generator-drift, repo-enum-drift, repo-displayformat-drift, repo-visible-drift, repo-field-unused, repo-constraint-without-message. See repo-lint-rules.
Dependency injection (D3a, D3b)
di-captive-dependency, di-resolve-in-hot-handler, di-register-after-build, di-build-missing: see di-container-rules.