question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make yaml check error on duplicate keys

See original GitHub issue

We make this mistake all the time:

# foo.yaml

'key1': false
'key2': true
'key1': true

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:1
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

3reactions
ssbarneacommented, Jul 1, 2018

I am not sure about check-yaml implementation but I am using the yamllint linter which is probably the most advanced, and it does catch duplicate keys.

  - repo: https://github.com/adrienverge/yamllint.git
    rev: v1.11.1
    hooks:
      - id: yamllint
        files: \.(yaml|yml)$

Obviously that this should not be taken as a reason not to fix it official pre-commit hooks. I would myself support getting yamllint into main repo, maybe even removing the check-yaml one.

0reactions
matt212commented, Jan 31, 2019

@asottile 😞😞

Read more comments on GitHub >

github_iconTop Results From Across the Web

Duplicate key in YAML configuaration file - Stack Overflow
Your error is that key1 is used two times as mapping key in the root node. ... The solution is to make all...
Read more >
Duplicate keys - HitchDev
Duplicate keys are allowed in regular YAML - as parsed by pyyaml, ruamel.yaml and poyo: Not only is it unclear whether x should...
Read more >
How to detect duplicate tags in an input YAML files?
If both forms are used as keys in the same mapping, only a YAML processor which recognizes integer formats would correctly flag the...
Read more >
ruamel.yaml 0.16.1 - PyPI
ruamel.yaml is a YAML parser/emitter that supports roundtrip preservation of ... duplicate keys are now an error when working with the old API...
Read more >
Repeated key in YAML files [#3256376] | Drupal.org
Check all YAML files for duplicate keys. Remaining tasks. User interface changes. API changes. Data model changes. Comment ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found