Menu

#562 Line wrapping exceeds requested width with for quoted and folded strings

open
nobody
None
minor
bug
2026-01-28
2026-01-28
No

Line wrapping works correctly for unquoted strings but doesn't for quoted and folded ones. This causes issues with formatters/linters which are based on ruamel.yaml (e.g. ansible-lint --fix).

# Unquoted: OK (max: 80)
echo "key: $(seq -s " " 1 150)" | uv run python3 -c "import sys; from ruamel.yaml import YAML; yaml = YAML(); yaml.preserve_quotes = True; yaml.dump(yaml.load(sys.stdin), sys.stdout)" | wc -L
# OUTPUT: 80

# Quoted: Wrong (max: 83)
echo "key: \"$(seq -s " " 1 150)\"" | uv run python3 -c "import sys; from ruamel.yaml import YAML; yaml = YAML(); yaml.preserve_quotes = True; yaml.dump(yaml.load(sys.stdin), sys.stdout)" | wc -L
# OUTPUT: 83

# Folded: Wrong (max: 82)
echo -e "key: >\n  $(seq -s " " 1 150)" | uv run python3 -c "import sys; from ruamel.yaml import YAML; yaml = YAML(); yaml.preserve_quotes = True; yaml.dump(yaml.load(sys.stdin), sys.stdout)" | wc -L
# OUTPUT: 82

Discussion


Log in to post a comment.

MongoDB Logo MongoDB