← Back to issue list

linters: allow ignoring files per-linter

View original Github issue

Metadata

Project
snapcraft
Number
#3931
Type
pull request
State
merged
Author
tigarmo
Labels
Created
Updated
Closed

Current evaluation

Merged. Restructures lint.ignore to support per-linter file exclusions for finer-grained control. Approved, passed CI with 100% diff coverage, and modified 9 files. Preserves ability to disable entire linters.

Suggested action:

No scores available.

Issue body

This commit restructures the lint.ignore project section to allow ignoring files on a per-linter basis. This still lets the user disable all issues for a given linter, but allows for finer-grained control. This is the current scheme (before this PR): ```yaml lint: ignore: linters: - library - classic files: - "elf.*" - lib/libfoo.so.1 ``` The two entries (`linters` and `files`) are unrelated and complementary: If `linters` has e.g. `library`, then all `library` linting is ignored, regardless of `files`. If `files` has e.g. "elf.*", then any linting issue found matching that glob will be ignored, regardless of `linters`. This is the new scheme implemented in this PR: ```yaml lint: ignore: library: - lib/libfoo.so.1 # Disable "library" linter only for lib/libfoo.so.1 classic: # Disable "classic" linter for all files ``` Since the way that this is described in the Pydantic model is a bit "less-than-intuive" in the way that `classic` being a key with `None` as value actually means "all" files, I added a couple of methods to use as the "public" API to hopefully hide that complexity a bit.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged. Restructures lint.ignore to support per-linter file exclusions for finer-grained control. Approved, passed CI with 100% diff coverage, and modified 9 files. Preserves ability to disable entire linters.
qwen3.6-35b-a3b-mtp-q6 Merged. Restructures lint.ignore to support per-linter file exclusions, replacing the previous independent lists. Adds helper methods to simplify Pydantic model usage. Codecov confirms successful merge with 100% diff coverage.
qwen3.6-35b-a3b-mtp-q6 Merged restructured lint.ignore config for per-linter file exclusions. Replaced separate lists with a nested structure and added helper methods to simplify the Pydantic model. Codecov confirms successful merge with 100% diff coverage.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#3872 linters: add missing library linter snapcraft merged Merged changes add a missing library linter to list ELF dependencies in the payload directory and fix filename filtering in the classic linter. Approved, passed CI, and increased coverage by 0.02%.
74%
#4077 linters: allow "categories" for subfiltering snapcraft merged Merged. Adds linter categories for finer-grained filtering, supporting unused-library and missing-library checks in LibraryLinter. Deferred user versus extension lint ignore override handling to a separate task.
74%
#3672 linters: address issues and enable pylint in ci snapcraft merged Merged after approval and CI pass. The PR addressed linter issues and enabled pylint in CI across 8 files. Changes increased test coverage by 0.02% with 100% diff coverage, successfully integrating static analysis into the pipeline.
73%
#77 lint: fix linting issues with up-to-date linters craft-store merged Merged a maintainer-submitted pull request resolving linting errors from updated linter versions. Approved by one reviewer, passed CI, and modified 11 files (+40/-24 lines).
72%
#36 Lint imagecraft merged Merged a single-file linting adjustment with one addition and one deletion. The maintainer-submitted change required no reviews or CI checks before integration.
71%
#3847 linters: add linting infrastructure snapcraft merged Merged. Adds basic linting infrastructure to snapcraft, including a lint entry in snapcraft.yaml to disable specific linters before packing. JSON output is implemented for future use. Approved, rebased, and passed coverage checks.
71%
#4815 linter updates snapcraft merged Merged linter updates across 10 files, reducing 56 lines and adding 26. Approved by two reviewers with zero unresolved comments.
70%
#18 lint: update linters craft-archives merged Merged maintainer lengau's pull request updating project linters. The change modified two files with a net reduction of six lines. Approved by one reviewer with no unresolved comments, the update was successfully integrated.
70%