Skip to content

no-flow-mappings

GitHub ActionsYAMLstyleno fixdefault: off

Reports a flow mapping ({a: 1}), on its opening brace. With allow_empty, an empty one ({}) is not reported.

Block style is the main style of YAML: one entry to a line, with diffs that show a single changed entry. A flow mapping packs entries on one line, so a change touches the whole line and long ones wrap badly.

To fix, write the entries on their own lines.

With this configuration:

no-flow-mappings:
level: warn
options:
allow_empty: true
Reported
a: {x: 1}
b: {}
c: { # note
}
github-actions:
lint:
rules:
no-flow-mappings:
level: warn # off (default), warn, error
options:
allow_empty: false
yaml:
lint:
rules:
no-flow-mappings:
level: warn # off (default), warn, error
options:
allow_empty: false
Option Type Default Description
allow_empty bool false Do not report empty collections ({}, []).

Suppress one line with sudsy-disable-next-line no-flow-mappings in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
yamllint braces.forbid full