A linter is an analysis tool that checks for common errors or compatibility issues, usually automatically, or as part of some other process.
Snapcraft (from version 7.2 onwards) includes its own linter functionality when working with snaps using the core22
base.
Snapcraft linters run automatically when a snap is packed unless otherwise disabled.
Snapcraft provides the following linters:
Snapcraft linters run automatically when a snap is packed but specific linters can be disabled by specifying a ignore
entry in the lint
section of snapcraft.yaml
:
lint:
ignore:
- classic
- library
The ignore
entry must include one or more linter names for those linters to be disabled.
You can tell a linter to ignore specific files. When configured this way, the lint.ignore.<linter>
key acts as a blocklist instead of disabling the linter entirely.
To instruct a linter to ignore a specific file:
lint.ignore.<linter>
key. The path can contain glob patterns to match multiple files.In this example, the classic linter checks no files, and the library linter checks every file except those matching a particular glob pattern:
lint:
ignore:
- classic
- library:
- usr/lib/**/libfoo.so*
Last updated a day ago.