radFormatter / docs / embarcadero style guide

Embarcadero style guide

radFormatter ships a built-in Embarcadero profile that maps its settings to Embarcadero's official Delphi Object Pascal Style Guide for RAD Studio. This page explains what that profile does, which style-guide recommendations it enforces, and which ones fall outside a formatter's scope.

Official style-guide references:

Using the profile

Select it on the CLI:

> radFormatter -profile Embarcadero -w -d source -r

The profile is a complete starting point. To adjust any individual setting, overlay your own JSON with -config — only the keys you list change:

> radFormatter -profile Embarcadero -config team-overrides.json -w source/MyUnit.pas

The companion radFormatter.Embarcadero.json is the full profile written out explicitly (equivalent to -profile Embarcadero). To adopt it, either save it into your project as radFormatter.json (the conventional active-config name) or pass it directly:

> radFormatter -config radFormatter.Embarcadero.json -w -d source -r

Download radFormatter.Embarcadero.json

Unlike the conservative Default profile, Embarcadero performs active formatting: it lowercases keywords, normalizes spacing, reflows begin/end and control bodies (lineBreaks.keepUser is false), and wraps at a 160-column margin.

See the configuration options reference for the meaning of every key.

Settings mapped to the style guide

Style-guide recommendationradFormatter (Embarcadero) setting
Use lowercase language keywords, reserved words, and compiler directives.casing.keywords: "lower", casing.directives: "lower"
Keep identifiers in their intended Pascal casing.casing.identifiers: "asis" (radFormatter never rewrites identifier casing)
Two spaces per indentation level; no tabs.indent.size: 2, indent.style: "spaces"
Two-space continuation indent for wrapped statements/declarations.indent.continuationSize: 2
Keep compiler directives at the left margin.indent.directives: "column0"
Indent case labels relative to case, and case-arm bodies relative to the label; keep case's else with the labels.indent.caseLabels: true, indent.caseContent: true, indent.caseElseAlignment: "withLabels"
Spaces around assignment and binary operators.spacing.assignment: "both", spacing.aroundBinaryOperators: "yes"
A single space after commas, declaration colons, and semicolons; none before.spacing.comma: "after", spacing.colon: "after", spacing.semicolon: "after"
No spaces just inside parentheses or brackets.spacing.insideParens: "no", spacing.insideBrackets: "no"
No space between a routine name and its parameter parenthesis.spacing.beforeParens: "no"
No space before an index/bounds bracket.spacing.beforeBracket: "no"
No spaces inside generic angle brackets.spacing.genericBrackets: "no"
No spaces around the subrange operator ..spacing.aroundRange: "no"
No space between a unary/prefix operator (or cast) and its operand.spacing.aroundUnaryOperators: "no"
Put begin and end on their own lines; give control-statement bodies their own line.lineBreaks.beforeBegin: "yes", lineBreaks.afterBegin: true, lineBreaks.beforeSingleInstr: "yes"
Keep at most one statement on a line.lineBreaks.lineAfterSemicolon: true
Preserve the accepted else if same-line style.lineBreaks.betweenElseAndIf: false
One uses entry per line, following the lowercase uses keyword.lineBreaks.usesMode: "onePerLine"
Avoid vertical alignment of declarations.all alignment.* off
Separate major logical sections with a blank line, but no repeated blank lines.output.maxEmptyLines: 1, output.emptyLines.aroundSections: 1, output.emptyLines.betweenDeclarations: 1, output.emptyLines.beforeTypeKeyword: 1, output.emptyLines.beforeVisibility: 0
Wrap long lines at a conventional editor width.output.rightMargin: 160

Handled automatically by the CST indent engine

Several style-guide layout rules need no option — the concrete-syntax indent engine produces them structurally:

Not enforced by radFormatter

Semantic / organizational (out of scope for a layout formatter)

These are recommendations about what the code says, not how it is spaced, so radFormatter deliberately leaves them alone:

Notes