no-flow-mappings
What it does
Section titled “What it does”Reports a flow mapping ({a: 1}), on its opening brace. With allow_empty, an empty one ({}) is not reported.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”With this configuration:
no-flow-mappings: level: warn options: allow_empty: truea: {x: 1}b: {}c: { # note }Configuration
Section titled “Configuration”github-actions: lint: rules: no-flow-mappings: level: warn # off (default), warn, error options: allow_empty: falseyaml: 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.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| yamllint | braces.forbid |
full |