Delphi-RAG-Lint

YADF options

Pack several statements on one line

Since: 1.0.21.0 · Default: false · INI key: PackStatements · CLI flag: --pack-statements

Several statements on one line. Two-way: unchecked means the opposite layout, not "leave as written".

On: adjacent plain statements -- assignments and calls written on consecutive lines at the same depth, with no block keyword, no label and no comment -- are packed onto one line while the line fits the max line length (A:= 1; / B:= 2; becomes A:= 1; B:= 2;).

Off (default): one statement per line (A:= 1; B:= 2; becomes two lines).

Fixed rule, whatever this option says: block keywords start a line and a block body never stays on its header line -- a routine begin, repeat / until, try / finally / except, case ... of and its arms, a record or class body and its visibility sections, and every end. Only "Fold short begin..end onto one line" may fold a short begin..end onto one line. Two declarations written on one line (A: Integer; B: string;) are always split one per line.

Left as written: a line holding a comment or a {$...} directive, an anonymous method, a procedural type, an anonymous record type in a declaration (R: record X: Integer; end;), an empty class or record (TFoo = class end;). Applies whether "Reflow lines" is on or off.

Example

Real YADF output for the "PackStatements" block of the preview sample (Demo\Sample.pas), all other options at their defaults:

// input
procedure ShowPackStatements(var K: Integer);
begin
  K:= 1; Inc(K);
end;

// PackStatements = false (default)
procedure ShowPackStatements(var K: Integer);
begin
  K:= 1;
  Inc(K);
end;

// PackStatements = true
procedure ShowPackStatements(var K: Integer);
begin
  K:= 1; Inc(K);
end;
  • Reflow lines (join and wrap) - Join a statement broken by hand when it fits the max line length and wrap longer lines. Off = the author's line breaks are kept and long lines are left as-is.
  • Trim trailing spaces - Trim trailing whitespace from every output line.
  • Max blank lines - Maximum consecutive blank lines kept in output. Excess blanks are collapsed.