quoted-strings: Fix explicit octal recognition
PyYAML implements YAML spec version 1.1, not 1.2. Hence, values starting with `0o` are not considered as numbers: they are just strings, so they need quotes when `quoted-strings: {required: true}`. >>> import yaml >>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '100', (True, False)) 'tag:yaml.org,2002:int' >>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '0100', (True, False)) 'tag:yaml.org,2002:int' >>> yaml.resolver.Resolver().resolve(yaml.nodes.ScalarNode, '0o100', (True, False)) 'tag:yaml.org,2002:str' Let's try to prevent that. Fixes https://github.com/adrienverge/yamllint/issues/351.pull/358/head
parent
a3fc64d134
commit
1b378ed5b9
Loading…
Reference in New Issue