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 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

SettingDefaultFormatterExeEmbarcaderoNoOp
Keep user line breaksyesnoyesyes
Keyword casingas-isas-isloweras-is
Directive casingas-isupperloweras-is
Number casingas-isupperas-isas-is
Identifier casingas-isfirst-occurrenceas-isas-is
Operator / punctuation spacingas-isactiveactiveas-is
begin on its own line + break afternoyesyesno
Break single-instruction control bodyas-isyesyesas-is
One statement per line (break after ;)nonoyesno
uses layoutpreservepreserveone per linepreserve
Section keyword join (private type)preservepreservejoinpreserve
Right marginoff80160off
Line endingplatformcrlfplatformdetect
Conditional modeactive branchactive branchactive branchpreserve conditionals
Max empty linesunlimited11unlimited
Blank lines around sectionsas-is11as-is
Indent size2220 (off)
Indent characteras-isspacesspacesas-is
Directive indentationas-iscolumn 0column 0as-is
Stand-alone label indentbody levelbody levelblock openerbody level
case-arm indentationonononoff
case else alignmentas-iswith labelswith labelsas-is
Alignmentoffoffoffoff
Strict modeonononoff

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. Like FormatterExe — active spacing, begin-style control bodies, blank lines around sections — 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. Unlike FormatterExe, Embarcadero keeps your existing line breaks (the style guide makes no call on un-wrapping), so only the structural forced breaks above reshape the code:

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:

A guaranteed no-change pass — for example, to verify radFormatter's round-trip safety on a file.
A minimal, opt-in team config — start from a profile that changes nothing, then enable only the handful of rules your team agrees to enforce (via a small -config overlay) and leave everything else exactly as written. This is the least invasive way to adopt the formatter incrementally.

Choosing a profile

ProfileReach for it when…
DefaultYou want structural reindent with no opinionated reflow. The safest starting point.
FormatterExeYou want to match RAD Studio's built-in formatter output.
EmbarcaderoYou want to follow the official Embarcadero style guide.
NoOpYou 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.