Skip to content

Flow mapping with foot comment has no superfluous comma #405

Description

@ccoVeille

I found a issue on a fork of go-yaml/yaml (the initial one)

braydonk/yaml#22

There is reporting of bug, that also affects our fork

Here is the issue

# a foot comment attached to a flow mapping must not add a superfluous trailing
# comma before the closing '}'.
- roundtrip:
    name: Flow mapping with foot comment has no superfluous comma
    yaml: |
      ---
      - {foo: bar}
      # comment
    want: |
      ---
      - {foo: bar}
      # comment

currently we provide

---
- {foo: bar,}
# comment

The extra , should not be there.

it should be

---
- {foo: bar}
# comment

The fix is easy and is the one suggested in braydonk/yaml#22 and google/yamlfmt#323

I didn't see any side effect in fixing this. Maybe @mikefarah would be able to catch an issue with yq test suite.

Related somehow to

and possible fixes

Note

this won't provide a fix for google/yamlfmt/ as it uses https://github.com/braydonk/yaml/

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions