Skip to content

allow double quotes for continuation, even if quote-type is ‘single’ #753

@dato

Description

@dato

This is similar to #663, but not quite the same.

Consider:

$ cat cont.yaml
a: "b\
    c"

Comparing yamllint 1.35 to 1.37, I see an improvement, since quotes are allowed now:

$ yamllint --version && yamllint -d 'rules: {quoted-strings: {required: only-when-needed, quote-type: double}}' cont.yaml
yamllint 1.35.1
./cont.yaml
  1:4       error    string value is redundantly quoted with double quotes  (quoted-strings)

$ pip install yamllint==1.37.1
$ yamllint --version && yamllint -d 'rules: {quoted-strings: {required: only-when-needed, quote-type: double}}' cont.yaml
yamllint 1.37.1

However, if I change to using quote-type: single, yamllint complains that I’m using double quotes instead of single quotes:

$ yamllint --version && yamllint -d 'rules: {quoted-strings: {required: only-when-needed, quote-type: single}}' cont.yaml              
yamllint 1.37.1
cont.yaml
  1:4       error    string value is not quoted with single quotes  (quoted-strings)

(To the best of my knowledge, backslash-as-continuation-char only works with double quotes, not single quotes. The sample cont.yaml would typically be used for much longer strings, of course.)

Thanks for considering!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions