yaml: detect and log warning on duplicate keys in snapcraft.yaml (CRAFT-553)
Metadata
Current evaluation
Merged into master after rebasing and approval. Adds a warning check for duplicate keys in snapcraft.yaml, logging all occurrences. Multiple warnings may trigger due to repeated file loads, to be optimized later.
Suggested action: —
No scores available.
Issue body
A very primitive check to warn if duplicate keys are found in
the snapcraft.yaml. At the moment the file is loaded multiple
times which may result in duplicate warnings (ha ha) which we
need to address in future work. Given that there shouldn't be
duplicates in YAML files, the extra verbosity should be OK.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged into master after rebasing and approval. Adds a warning check for duplicate keys in snapcraft.yaml, logging all occurrences. Multiple warnings may trigger due to repeated file loads, to be optimized later. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Adds duplicate key detection in snapcraft.yaml, logging warnings for all occurrences. Updated to report every duplicate instead of just the first, rebased, and approved. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to master. Implements duplicate key detection and warning logging for snapcraft.yaml. Updated to flag all duplicates instead of just the first. Rebased and approved by maintainers prior to merge. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3517 yaml: detect and log warning on duplicate keys in snapcraft.yaml | snapcraft | closed | Duplicate key detection and warnings for snapcraft.yaml were closed without review or merge. The implementation remains abandoned due to zero reviewer engagement and missing CI checks. | |
| #4394 Too many repetitions of the same warning | snapcraft | closed | Resolved in snapcraft 8.4.4. The fix prevents the CRAFT_ARCH_TRIPLET deprecation warning from spamming verbose logs by ensuring it only prints once per deprecated variable usage. |