← Back to issue list

fix(lint): lint snaps in a build environment matching their base

View original Github issue

Metadata

Project
snapcraft
Number
#6448
Type
pull request
State
closed
Author
wak327
Labels
—
Created
Updated
Closed

Current evaluation

Proposed base-aware lint environments for newer snaps, but PR #6448 was closed unmerged after two days without review; issue #6332 remains open.

Resolution: closed stale

Reason: PR #6448 received no reviewer feedback and was closed without a resolving commit or merge. The base-detection change therefore did not land, and the underlying bug remains open in #6332.

Evaluated by: mr-cal-bot

No scores available.

Issue body

`snapcraft lint` always launched a core22 instance, so snaps built on newer bases were linted against the wrong base. For core26 snaps this caused the spurious unused-library warnings and bash errors from the issue. The command now reads `meta/snap.yaml` from the snap file on the host, with the same `get_data_from_snap_file()` helper that `upload` and `sign-build` use, and launches an instance for the snap's base. Snaps with a base that isn't supported as a build environment, such as core20, bare, or no base, are still linted in a core22 instance. The command's help text describes this. Besides the unit tests, I checked the base detection against real squashfs snaps with core20, core24, and core26 bases. Fixes #6332 --- - [x] I've followed the [contribution guidelines](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md). - [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/). - [x] I've successfully run `make lint && make test`. - [x] I've added or updated any relevant documentation. - [ ] In documents I changed, I [added a meta description](https://canonical-starflow.readthedocs-hosted.com/how-to/add-a-page-meta-description/) if one was missing. - [ ] I've updated the relevant release notes.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed stale Proposed base-aware lint environments for newer snaps, but PR #6448 was closed unmerged after two days without review; issue #6332 remains open.
stealth/space-bunny-alpha — closed stale Fix for #6332 was proposed in #6448, but #6448 was closed unmerged with zero reviewers; no fix shipped, and #6332 remains open.
qwen/qwen3.8-27b — closed stale PR to make snapcraft lint use the snap's actual base instead of hardcoded core22 was closed without merge after 2 days with zero reviewers; issue #6332 remains open.
stealth/space-bunny-alpha
Impact: 52
Quick Win: 27
Complexity: 32
Confidence: 80
Actionability: 75
needs review Makes `snapcraft lint` read meta/snap.yaml via get_data_from_snap_file() and launch an instance matching the snap's base (falling back to core22 for unsupported bases), fixing spurious warnings. +84/-4, unit tests, awaiting review.

Update history

Date Change
closed
updated
created

Related work

  • Related To: canonical/snapcraft#6332 (confidence 100%)

    The PR proposed a fix for these spurious lint warnings, but the issue remains unresolved.

Related issues

Issue Project State Summary Similarity
#4115 lint: lint snap files inside an instance snapcraft merged Merged as ddd328f07, #4115 adds in-instance snap linting that unsquashes and installs the snap, reads metadata and filters, runs the linter, and reports warnings (CRAFT-1689).
74%
#470 feat(lint): lint the Github actions with actionlint starbase closed Closed unmerged; the same actionlint integration shipped via merged PR #473 (commit e385e9d), wiring the actionlint snap into starbase's default lint target.
71%