Inline comment in YAML files

http://www.yamllint.com/

I use the following linter to check if my yml is valid.

I tried to insert inline comments, but they are removed. I read the spec here http://www.yaml.org/spec/1.2/spec.html#id2780069

I will correct that the following is actually valid: is the website listing erroneous by deleting comments?

cache: 
  paths: 
    - node_modules/ # some comment here
+6
source share
1 answer

. ​​ , , Python ruamel.yaml, ( : ruamel.yaml):

import sys
from ruamel.yaml import round_trip_dump
from ruamel.yaml.util import load_yaml_guess_indent

with open(sys.argv[1]) as fp:
    data, ind, bsi = load_yaml_guess_indent(fp)
round_trip_dump(data, sys.stdout, indent=ind, block_seq_indent=bsi)

.

-, "". yamllint.com , YAML 1.2. yamllint.com YAML 1.1, , YAML:

%YAML 1.2
--- 
a: 0o7
...

, . , , , http://yaml-online-parser.appspot.com/ ( , YAML 1.1, , , ) -fledged YAML http://beautifytools.com/yaml-validator.php (: ))

+4

All Articles