radFormatter / docs / profiles
Profiles
A profile is a named starting point for configuration.
radFormatter ships four built-in profiles. Whatever you pass with
-config is overlaid on top of the profile, so you only specify
the keys you want to change.
> radFormatter -profile Embarcadero -config team.json -w source/MyUnit.pas
Omitting -profile uses Default. Every option
and its values are described in the
configuration options reference; this page
summarizes how the four profiles differ and shows each one on the same input.
At a glance
| Setting | Default | FormatterExe | Embarcadero | NoOp |
|---|---|---|---|---|
| Keep user line breaks | yes | no | no | yes |
| Keyword casing | as-is | as-is | lower | as-is |
| Directive casing | as-is | upper | lower | as-is |
| Number casing | as-is | upper | as-is | as-is |
| Identifier casing | as-is | first-occurrence | as-is | as-is |
| Operator / punctuation spacing | as-is | active | active | as-is |
begin on its own line + break after | no | yes | yes | no |
| Break single-instruction control body | as-is | yes | yes | as-is |
One statement per line (break after ;) | no | no | yes | no |
uses layout | preserve | preserve | one per line | preserve |
| Right margin | off | 80 | 160 | off |
| Line ending | auto | crlf | auto | auto |
| Max empty lines | unlimited | 1 | 1 | unlimited |
| Blank lines around sections | as-is | 1 | 1 | as-is |
| Indent size | 2 | 2 | 2 | 0 (off) |
case-arm indentation | on | on | on | off |
| Alignment | off | off | off | off |
| Strict mode | on | on | on | off |
All four leave alignment off and never reshape calls, enums, arrays, or inheritance lists onto separate lines.
The same code under each profile
Given this input:
unit Demo;
interface
uses System.SysUtils, System.Classes;
implementation
procedure Test(A, B: Integer);
begin
IF A>0 THEN DoIt(A);
B:=A*2+1;
end;
end.
Default
Conservative. It reindents to a 2-space structure and applies
case-arm layout, but preserves your spacing, casing, and line
breaks. For the input above — already 2-space indented — the output
is unchanged:
unit Demo;
interface
uses System.SysUtils, System.Classes;
implementation
procedure Test(A, B: Integer);
begin
IF A>0 THEN DoIt(A);
B:=A*2+1;
end;
end.
Note that IF A>0 keeps its casing and tight spacing, and
the single-line if ... then DoIt(A) is left intact. Use Default
when you want structural indentation without opinionated reflow.
FormatterExe
Approximates RAD Studio's built-in Formatter.exe: active spacing, blank
lines around sections, begin-style control bodies, uppercase
directives/numbers, and an 80-column right margin. Keyword casing is
left as-is (note IF / THEN stay
uppercase):
unit Demo;
interface
uses System.SysUtils, System.Classes;
implementation
procedure Test(A, B: Integer);
begin
IF A > 0 THEN
DoIt(A);
B := A * 2 + 1;
end;
end.
Embarcadero
The Embarcadero Delphi style guide. Everything FormatterExe does, plus
lowercase keywords and directives (if /
then), one uses entry per line, one statement per
line (a break after every statement-terminating semicolon), and a 160-column
right margin:
unit Demo;
interface
uses System.SysUtils,
System.Classes;
implementation
procedure Test(A, B: Integer);
begin
if A > 0 then
DoIt(A);
B := A * 2 + 1;
end;
end.
See the Embarcadero style guide for the full style-guide mapping.
NoOp
Pass-through. Output matches input byte-for-byte (modulo line-ending
normalization). Indentation, case-arm structure, and strict mode
are all disabled:
unit Demo;
interface
uses System.SysUtils, System.Classes;
implementation
procedure Test(A, B: Integer);
begin
IF A>0 THEN DoIt(A);
B:=A*2+1;
end;
end.
Default vs NoOp
For the sample above the two look identical, but they are not the same
profile. Default still reindents (indent size 2) and applies
case-arm structure, so mis-indented input is corrected.
NoOp disables indentation entirely (indent size 0) and turns
strict mode off, so it never moves a character.
Two good reasons to reach for NoOp:
-config overlay) and
leave everything else exactly as written. This is the least invasive way to
adopt the formatter incrementally.Choosing a profile
| Profile | Reach for it when… |
|---|---|
| Default | You want structural reindent with no opinionated reflow. The safest starting point. |
| FormatterExe | You want to match RAD Studio's built-in formatter output. |
| Embarcadero | You want to follow the official Embarcadero style guide. |
| NoOp | You want a guaranteed no-op — a baseline for overriding a few keys yourself. |
Whichever you pick, overlay a -config file to adjust
individual options; see the
configuration options reference.