-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Description
Considering the following valid YAML (this is the result I would like to achieve after auto-fix by pretty-format-yaml):
services:
svc:
image: "..."
volumes:
- "/tmp:/tmp"Using
--indent=4
--offset=2causes the auto-fix of the file to be over-indented as follows:
services:
svc: # all nested mappings over-indented
image: "..."
volumes:
- "/tmp:/tmp" # indent as expected herewhile
--indent=2
--offset=0results in:
services:
svc: # nesting indents preserved
image: "..."
volumes:
- "/tmp:/tmp" # de-indentedIt seems that the following should be valid:
--indent=2
--offset=2but it is blocked by the following check:
language-formatters-pre-commit-hooks/language_formatters_pre_commit_hooks/pretty_format_yaml.py
Lines 76 to 82 in 785e2cf
| if args.indent < args.offset + 2: | |
| print( | |
| "Indent should be at least 2 more than offset. \n" | |
| "Invalid output could be resulting otherwise. \n" | |
| "indent={}, offset={}".format(args.indent, args.offset) | |
| ) | |
| return 1 |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels