Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Quoted strings rule doesn't detect unquoted strings in array #208

Closed
mmerfort opened this issue Nov 11, 2019 · 1 comment · Fixed by #251
Closed

Bug: Quoted strings rule doesn't detect unquoted strings in array #208

mmerfort opened this issue Nov 11, 2019 · 1 comment · Fixed by #251

Comments

@mmerfort
Copy link

Hello,

I noticed that yamllint does not detect unquoted strings in an array even though this rule has been enabled:

Example

testfile.yaml

---
bla:
  - FOO
  - BAR
  - BAZ

configuration.yaml

---
extends: 'default'

rules:
  quoted-strings:
    quote-type: 'single'

I tried using different quote-types but none of them seem to work.

Thanks in advance.

@mmerfort mmerfort changed the title Bug: quoted strings rule doesn't detect unquoted strings in array Bug: Quoted strings rule doesn't detect unquoted strings in array Nov 11, 2019
@adrienverge
Copy link
Owner

Hi @mmerfort, thanks for the report, I can confirm the bug.

It also happens for:

ble: [FOO, BAR, BAZ]
bli: {FOO, BAR, BAZ}

I tested older versions of yamllint, and it seems that this doesn't work since the first commit that added the rule.

Any contribution contribution to fix this (and to add a non-regression test) would be welcome! https://github.com/adrienverge/yamllint/blob/0f073f7/yamllint/rules/quoted_strings.py

adrienverge added a commit that referenced this issue Apr 10, 2020
The rule worked for values like:

    flow-map: {a: foo, b: "bar"}
    block-map:
      a: foo
      b: "bar"

But not for:

    flow-seq: [foo, "bar"]
    block-seq:
      - foo
      - "bar"

Also add tests to make sure there will be no regression.

Fixes: #208.
adrienverge added a commit that referenced this issue Apr 13, 2020
The rule worked for values like:

    flow-map: {a: foo, b: "bar"}
    block-map:
      a: foo
      b: "bar"

But not for:

    flow-seq: [foo, "bar"]
    block-seq:
      - foo
      - "bar"

Also add tests to make sure there will be no regression.

Fixes: #208.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants