Type object
File match .cmakefmt.yaml .cmakefmt.yml .cmakefmt.toml
Schema URL https://catalog.lintel.tools/schemas/schemastore/cmakefmt/latest.json
Source https://cmakefmt.dev/schemas/latest/schema.json

Validate with Lintel

npx @lintel/lintel check
Type: object

The user-config file structure for .cmakefmt.yaml, .cmakefmt.yml, and .cmakefmt.toml.

All fields are optional — only specified values override the defaults.

Properties

format object
19 nested properties
always_wrap array | null

Command names (lowercase) that must always use vertical layout regardless of line width.

Default: null
dangle_align DangleAlign | null

Alignment strategy for a dangling ): prefix, open, or close.

Default: null
dangle_parens boolean | null

Place the closing ) on its own line when a call wraps.

Default: null
disable boolean | null

Disable formatting entirely and return the source unchanged.

Default: null
fractional_tab_policy FractionalTabPolicy | null

How to handle fractional indentation when use_tabs is true: use-space or round-up.

Default: null
line_ending LineEnding | null

Output line-ending style: unix (LF), windows (CRLF), or auto (detect from input).

Default: null
line_width integer | null

Maximum rendered line width before cmakefmt wraps a call. Default: 80.

Default: null
format=uintmin=0
max_empty_lines integer | null

Maximum number of consecutive blank lines to preserve. Default: 1.

Default: null
format=uintmin=0
max_hanging_wrap_groups integer | null

Maximum keyword/flag subgroups to keep in a hanging-wrap layout. Default: 2.

Default: null
format=uintmin=0
max_hanging_wrap_lines integer | null

Maximum wrapped lines to tolerate before switching to a more vertical layout. Default: 2.

Default: null
format=uintmin=0
max_hanging_wrap_positional_args integer | null

Maximum positional arguments to keep in a hanging-wrap layout. Default: 6.

Default: null
format=uintmin=0
max_prefix_length integer | null

Upper heuristic bound used when deciding between compact and wrapped layouts. Default: 10.

Default: null
format=uintmin=0
max_rows_cmdline integer | null

Maximum rows a hanging-wrap positional group may consume before nesting is forced. Default: 2.

Default: null
format=uintmin=0
min_prefix_length integer | null

Lower heuristic bound used when deciding between compact and wrapped layouts. Default: 4.

Default: null
format=uintmin=0
require_valid_layout boolean | null

Return an error if any formatted output line exceeds line_width.

Default: null
space_before_control_paren boolean | null

Insert a space before ( for control-flow commands such as if, foreach, while.

Default: null
space_before_definition_paren boolean | null

Insert a space before ( for function() and macro() definitions.

Default: null
tab_size integer | null

Number of spaces per indentation level when use_tabs is false. Default: 2.

Default: null
format=uintmin=0
use_tabs boolean | null

Indent with tab characters instead of spaces.

Default: null
markup object
11 nested properties
bullet_char string | null

Preferred bullet character when normalizing markup lists. Default: *.

Default: null
canonicalize_hashrulers boolean | null

Normalize ruler comments when markup handling is enabled.

Default: null
enable_markup boolean | null

Enable markup-aware comment handling.

Default: null
enum_char string | null

Preferred punctuation for numbered lists when normalizing markup. Default: ..

Default: null
explicit_trailing_pattern string | null

Regex pattern for inline comments explicitly trailing their preceding argument. Default: #<.

Default: null
fence_pattern string | null

Regex describing fenced literal comment blocks.

Default: null
first_comment_is_literal boolean | null

Preserve the first comment block in a file literally.

Default: null
hashruler_min_length integer | null

Minimum ruler length before a hash-only line is treated as a ruler. Default: 10.

Default: null
format=uintmin=0
literal_comment_pattern string | null

Regex for comments that should never be reflowed.

Default: null
reflow_comments boolean | null

Reflow plain line comments to fit within the configured line width.

Default: null
ruler_pattern string | null

Regex describing ruler-style comments that should be treated specially.

Default: null
per_command_overrides Record<string, object>

Per-command configuration overrides keyed by lowercase command name.

Default:
{}
style object
2 nested properties
command_case CaseStyle | null

Output casing for command names: lower, upper, or unchanged.

Default: null
keyword_case CaseStyle | null

Output casing for recognized keywords and flags: lower, upper, or unchanged.

Default: null

Definitions

CaseStyle string | string | string

How to normalise command/keyword casing.

DangleAlign string | string | string

How to align the dangling closing paren.

Only takes effect when [Config::dangle_parens] is true. Controls where ) is placed when a call wraps onto multiple lines:

# Prefix / Close — `)` at the command-name column (tracks block depth):
target_link_libraries(
  mylib PUBLIC dep1
)

# Open — `)` at the opening-paren column:
target_link_libraries(
  mylib PUBLIC dep1
                     )
FormatSection object
always_wrap array | null

Command names (lowercase) that must always use vertical layout regardless of line width.

Default: null
dangle_align DangleAlign | null

Alignment strategy for a dangling ): prefix, open, or close.

Default: null
dangle_parens boolean | null

Place the closing ) on its own line when a call wraps.

Default: null
disable boolean | null

Disable formatting entirely and return the source unchanged.

Default: null
fractional_tab_policy FractionalTabPolicy | null

How to handle fractional indentation when use_tabs is true: use-space or round-up.

Default: null
line_ending LineEnding | null

Output line-ending style: unix (LF), windows (CRLF), or auto (detect from input).

Default: null
line_width integer | null

Maximum rendered line width before cmakefmt wraps a call. Default: 80.

Default: null
format=uintmin=0
max_empty_lines integer | null

Maximum number of consecutive blank lines to preserve. Default: 1.

Default: null
format=uintmin=0
max_hanging_wrap_groups integer | null

Maximum keyword/flag subgroups to keep in a hanging-wrap layout. Default: 2.

Default: null
format=uintmin=0
max_hanging_wrap_lines integer | null

Maximum wrapped lines to tolerate before switching to a more vertical layout. Default: 2.

Default: null
format=uintmin=0
max_hanging_wrap_positional_args integer | null

Maximum positional arguments to keep in a hanging-wrap layout. Default: 6.

Default: null
format=uintmin=0
max_prefix_length integer | null

Upper heuristic bound used when deciding between compact and wrapped layouts. Default: 10.

Default: null
format=uintmin=0
max_rows_cmdline integer | null

Maximum rows a hanging-wrap positional group may consume before nesting is forced. Default: 2.

Default: null
format=uintmin=0
min_prefix_length integer | null

Lower heuristic bound used when deciding between compact and wrapped layouts. Default: 4.

Default: null
format=uintmin=0
require_valid_layout boolean | null

Return an error if any formatted output line exceeds line_width.

Default: null
space_before_control_paren boolean | null

Insert a space before ( for control-flow commands such as if, foreach, while.

Default: null
space_before_definition_paren boolean | null

Insert a space before ( for function() and macro() definitions.

Default: null
tab_size integer | null

Number of spaces per indentation level when use_tabs is false. Default: 2.

Default: null
format=uintmin=0
use_tabs boolean | null

Indent with tab characters instead of spaces.

Default: null
FractionalTabPolicy string | string

How to handle fractional tab indentation when [Config::use_tabchars] is true.

LineEnding string | string | string

Output line-ending style.

MarkupSection object
bullet_char string | null

Preferred bullet character when normalizing markup lists. Default: *.

Default: null
canonicalize_hashrulers boolean | null

Normalize ruler comments when markup handling is enabled.

Default: null
enable_markup boolean | null

Enable markup-aware comment handling.

Default: null
enum_char string | null

Preferred punctuation for numbered lists when normalizing markup. Default: ..

Default: null
explicit_trailing_pattern string | null

Regex pattern for inline comments explicitly trailing their preceding argument. Default: #<.

Default: null
fence_pattern string | null

Regex describing fenced literal comment blocks.

Default: null
first_comment_is_literal boolean | null

Preserve the first comment block in a file literally.

Default: null
hashruler_min_length integer | null

Minimum ruler length before a hash-only line is treated as a ruler. Default: 10.

Default: null
format=uintmin=0
literal_comment_pattern string | null

Regex for comments that should never be reflowed.

Default: null
reflow_comments boolean | null

Reflow plain line comments to fit within the configured line width.

Default: null
ruler_pattern string | null

Regex describing ruler-style comments that should be treated specially.

Default: null
PerCommandConfig object

Per-command overrides. All fields are optional — only specified fields override the global config for that command.

command_case CaseStyle | null

Override the command casing rule for this command only.

dangle_align DangleAlign | null

Override dangling paren alignment for this command only.

dangle_parens boolean | null

Override dangling paren placement for this command only.

keyword_case CaseStyle | null

Override the keyword casing rule for this command only.

line_width integer | null

Override the line width for this command only.

format=uintmin=0
max_hanging_wrap_groups integer | null

Override the hanging-wrap subgroup threshold for this command only.

format=uintmin=0
max_hanging_wrap_positional_args integer | null

Override the hanging-wrap positional argument threshold for this command only.

format=uintmin=0
tab_size integer | null

Override the indentation width for this command only.

format=uintmin=0
StyleSection object
command_case CaseStyle | null

Output casing for command names: lower, upper, or unchanged.

Default: null
keyword_case CaseStyle | null

Output casing for recognized keywords and flags: lower, upper, or unchanged.

Default: null