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

Raise an error when keys are duplicated in parameters files #866

Merged
merged 5 commits into from
Apr 18, 2019

Conversation

fpagnoux
Copy link
Member

Breaking changes

  • Duplicate keys in YAML parameters files now raise an error
    • Before, only one of the two values declared was taking into account, while the other was silently ignored

Rationale

  • Duplicate keys are easy to introduce by mistake while editing parameters files. They can cause bugs that are hard to detect immediately, and result in ambiguities in the code base that are hard to fix afterwards.

Performance impact

This implementation has no performance impact on the loading of the parameters file.

For the record, a first approach trying to use ruamel.yaml instead of pyyaml ended up degrading the loading time (with C loader) by a factor of almost 2, and was abandoned.

@fpagnoux
Copy link
Member Author

Thanks for the quick review!

@fpagnoux fpagnoux force-pushed the yaml-duplicate-keys branch from 78247f1 to 844d5c2 Compare April 18, 2019 14:59
@fpagnoux fpagnoux merged commit c6f88fe into master Apr 18, 2019
@fpagnoux fpagnoux deleted the yaml-duplicate-keys branch April 18, 2019 15:01
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 this pull request may close these issues.

3 participants