Wider scm rules and three new fixers
Seven built-in rules read more constructs; empty-finally, format-string-not-formatted and shared-marker-legacy-shape gain autofixes.
Read this when you want to know which constructs the 1.51 lint rules newly report or exempt, and which new fixes lint --fix offers.
How to run it
drag-lint lint <path> [--profile <name>] [--target-compiler <ver|auto>] [--rule <id>|help] [--disable id1,id2] [--rules-dir <dir>] [--json] [--labels] [--no-preprocess] [--library-db <lib.sqlite>] [--build-config <name>] [--no-budget]
Full flag list: lint in the CLI reference.
Where to click
No IDE surface: this feature runs from the CLI (see How to run it).
Details
Six built-in rules read more of the source in 1.51, and three rules gained an autofix.
Wider rules
large-magic-numberno longer fires on a string code page (AnsiString(1252)), a numeric label orgototarget, or an array bound (array[1..28] of Byte).deprecated-rtl-functionalso reportsGetWindowLong,SetWindowLong,GetClassLong,SetClassLong(32-bit only; use the*Ptrvariant) andResume/Suspendon a thread-named receiver.locale-sensitive-conversionalso reportsFormat('%f', [X])(and%e %g %n %mwith a non-zero precision) without aTFormatSettings.hardcoded-credentialalso reports a property assignment such asParams.Password := 'x'.sql-update-delete-without-wherealso reports an UPDATE / DELETE built from concatenated literals only.classname-string-comparealso reportsClassNameIs('TFoo'), a bareClassNameand a literal on the left.division-by-zero-literalalso reports$0and00.
1.51.1
division-by-zero-literalis float-only:X / 0andX / 0.0are reported;div 0/mod 0are dcc E2098 compile errors and are not.large-magic-numberalso exempts case labels, enum ordinals in a type declaration,dispid N, array subscripts (Params[3],Fields[2]) and the first argument ofReg(<int>, 'NAME').inherited-bareis not reported in Destroy / Assign / AssignTo or as theif not (X is T) then inherited elsefallback.
New fixers
drag-lint lint --in <file.pas> --fix --fix-rule empty-finally --apply
drag-lint lint --in <file.pas> --fix --fix-rule format-string-not-formatted --apply
drag-lint lint --in <file.pas> --fix --fix-rule shared-marker-legacy-shape --apply (risky, opt-in)
empty-finally unwraps an aligned try ... finally end;. format-string-not-formatted turns Format('text', []) into 'text'. shared-marker-legacy-shape rewrites // note // dl:shared A to // dl:shared A // note; it cannot tell that from prose, so it is opt-in.