A tool for cleaning and refining your snaps
Snaplint is an attempt to encode best-practices for snapping software. To that end, snaplint will scan a prime
directory generated by snapcraft and offer suggestions on how to improve your snap.
These are the currently supported rules:
- copyright: check that copyright data is included for:
- parts (under
usr/share/<part name>/copyright
) - staged packages
- parts (under
- developer-cruft: make sure that header files, object files, and static libraries are not included
- libraries: list those shared libraries in the snap which are not actually used by any apps
You can run snaplint from a git checkout like so:
$ ./bin/snaplint <path/to/project>
It's also available as a snap.
$ snap install snaplint
$ snaplint <path/to/project>
Adding rules to snaplint is simple. Drop a file in snaplint/rules/
which contains a python class that inherits from Rule
. self.path
will contain the path to your prime
directory, and you can use convenience methods self.get_dir_list
and get_file_list
to get lists of files or directories in the snap.