← Back to issue list

clean: error out on invalid or missing yaml

View original Github issue

Metadata

Project
snapcraft
Number
#2458
Type
pull request
State
merged
Author
sergiusens
Labels
—
Created
Updated
Closed

Current evaluation

Merged #2458 via commit bf5dbbb3f, making clean fail safely when snapcraft.yaml is missing, invalid, or lacks a project name.

Resolution: closed resolved

Reason: The approved change was merged as commit bf5dbbb3f. It validates snapcraft.yaml and its name before cleanup, reducing the risk of cleaning a non-Snapcraft project.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Reduce the risk of cleaning a non snapcraft base project by erroring out if the snapcraft.yaml or the name is not defined in it. LP: #1777501 Signed-off-by: Sergio Schvezov <sergio.schvezov@canonical.com> - [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [ ] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [ ] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [ ] Have you successfully run `./runtests.sh static`? - [ ] Have you successfully run `./runtests.sh tests/unit`? -----

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged #2458 via commit bf5dbbb3f, making clean fail safely when snapcraft.yaml is missing, invalid, or lacks a project name.
stealth/space-bunny-alpha — closed resolved Merged #2458 in commit bf5dbbb3f: clean now errors when snapcraft.yaml is missing or lacks a name, preventing cleanup of non-Snapcraft projects.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#2458 via commit bf5dbbb3f: clean now errors when snapcraft.yaml is missing or lacks a name, reducing accidental cleanup of non-snapcraft projects.
qwen/qwen3.6-35b-a3b — — Merged. Modifies the clean command to fail if snapcraft.yaml is missing or lacks a name field, preventing accidental cleanup of non-snapcraft projects. Resolves LP #1777501. Approved, passed CI, and merged.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Adds validation to the clean command to fail if snapcraft.yaml is missing or lacks a name field, preventing accidental cleanup of non-snapcraft projects. Code coverage reports 100% diff.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1777501 snapcraft clean should require a minimal valid yaml with at least a name snapcraft (launchpad) closed Added validation so snapcraft clean rejects missing or invalid snapcraft.yaml without a name; fixed by merged PR #2458 (commit bf5dbbb3f).
78%
#1007 lifecycle: clean without parsing if possible. snapcraft merged Merged in snapcraft#1007 via commit bacf75dfe, allowing full clean operations to bypass snapcraft.yaml parsing unless part-specific cleanup is required.
70%
#3526 project: validate snapcraft yaml before using it (CRAFT-55) snapcraft closed Merged PR #3526 in commit 38891b17d, validating project YAML in get_project() before extensions or snap metadata consume potentially invalid data.
70%