Closed robherring closed 11 months ago
Hello and thanks for tackling this!
It looks good at first glance, but could you add more tests with nested flows, to prove the functionnality of
flow_cnt
? (By the way you can rename it toflow_count
orflow_nest_count
for clarity)
Sure.
Does this address the
field: ["foo,bar"]
case too?
Yes
From what I see in the new test cases it reports
[foo, "foo,bar"]
as a failure, which is wrong, isn't it? 🤔
That one is testing the quotes are the right type.
Flow maps and sequences need quotes if the values contain any of the flow tokens ({}, [], ','). However, yamllint generates false positives in these cases:
$ yamllint -d 'rules: {quoted-strings: {required: only-when-needed}}' - <<<'field: ["string[bracket]"]' 1:9 error string value is redundantly quoted with any quotes (quoted-strings)
To fix this, track when inside a flow map/sequence and skip the quoting checks except for the quoting type.
Closes #516