2016-09-19 21:41:01 +00:00
|
|
|
=====
|
|
|
|
Usage
|
|
|
|
=====
|
|
|
|
|
|
|
|
Command Line
|
|
|
|
------------
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
|
|
|
|
git lint [options] [filenames]
|
|
|
|
|
|
|
|
Options
|
|
|
|
-------
|
2016-09-22 22:50:01 +00:00
|
|
|
``-o`` ``--only``
|
|
|
|
A comma-separated list of only those linters to run
|
|
|
|
``-x`` ``--exclude``
|
|
|
|
A comma-separated list of linters to skip
|
|
|
|
``-l`` ``--linters``
|
|
|
|
Show the list of configured linters
|
2016-09-19 21:41:01 +00:00
|
|
|
``-b`` ``--base``
|
2016-09-22 22:50:01 +00:00
|
|
|
Check all changed files in the repository, not just those in the current directory.
|
2016-09-20 21:59:20 +00:00
|
|
|
``-a`` ``--all``
|
2016-09-22 22:50:01 +00:00
|
|
|
Scan all files in the repository, not just those that have changed.
|
|
|
|
``-e`` ``--every``
|
|
|
|
Short for -b -a: scan everything
|
|
|
|
``-w`` ``--workspace``
|
|
|
|
Scan the workspace
|
|
|
|
``-s`` ``--staging``
|
|
|
|
Scan the staging area (useful for pre-commit).
|
|
|
|
``-g`` ``--changes``
|
|
|
|
Report lint failures only for diff'd sections
|
|
|
|
``-p`` ``--complete``
|
|
|
|
Report lint failures for all files
|
|
|
|
``-c`` ``--config``
|
|
|
|
Path to config file
|
|
|
|
``-d`` ``--dryrun``
|
|
|
|
Report what git-lint would do, but don't actually do anything.
|
|
|
|
``-q`` ``--quiet``
|
|
|
|
Produce a short report of files that failed to pass.
|
|
|
|
``-h`` ``--help``
|
|
|
|
This help message
|
|
|
|
``-v`` ``--version``
|
|
|
|
Version information
|
2016-09-19 21:41:01 +00:00
|
|
|
|
2016-09-20 21:59:20 +00:00
|
|
|
As a pre-commit hook:
|
|
|
|
---------------------
|
2016-09-19 21:41:01 +00:00
|
|
|
|
2016-09-22 22:50:01 +00:00
|
|
|
.. code-block:: python
|
|
|
|
|
2016-09-19 21:41:01 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import git_lint
|
|
|
|
git_lint.run_precommit(staging = True, timestamps = True)
|
|
|
|
|
|
|
|
Install this file in your project's ``.git/hooks/pre-commit``, and set
|
|
|
|
the file's executable flag to ``true``:
|
|
|
|
|
2016-09-22 22:50:01 +00:00
|
|
|
.. code-block:: shell
|
|
|
|
|
2016-09-19 21:41:01 +00:00
|
|
|
chmod +x pre-commit
|
|
|
|
|
|
|
|
Please see the :ref:`api` for more details on options taken by the
|
|
|
|
``run_precommit()`` and ``run_gitlint`` commands.
|
|
|
|
|