Skip to content

check-gitignore - run formatting and robustness checks on a gitignore file

[Home | sourcehut | PyPI | ReadTheDocs]

Overview

The check-gitignore tool examines a gitignore file (usually named .gitignore, e.g. in a top-level source directory or in a user's home directory) and checks it for several predefined robustness criteria, e.g. do the paths start with a slash, do directory paths end with a slash, are the definitions sorted, etc.

Examples

Run all the checks supported by the current version of check-gitignore (only do this with a pinned version, or new checks may surprise you):

check-gitignore check --enable=all -- /path/to/.gitignore

Run the checks defined at a specific policy version:

check-gitignore check --enable=0.0 -- /path/to/.gitignore

Enable some additional checks:

check-gitignore check --enable=0.0,sort-after-initial-block  -- /path/to/.gitignore

List the names of the checks that would be enabled:

check-gitignore show checks --enable=0.0,sort-after-initial-block  -- /path/to/.gitignore

Contact

The check-gitignore tool was written by Peter Pentchev. It is developed in a sourcehut repository. This documentation is hosted at Ringlet with a copy at ReadTheDocs.