git-lint(1)

NAME

git-lint - Run configured linters against changed files

SYNOPSIS

[verse] git lint [<options>...] [<files...>]

DESCRIPTION

Runs a list of configured linters against a specified list of files in your repository. By default all linters will be run against the changed files in your current workspace, from the current working directory on down. Command line options let you choose a different directory, a different of files, the complete set of files, and even the files currently in the staging area.

OPTIONS

-o <linters>, –only=<linters>
A comma-separated list of only those linters to run.
-x <linters> –exclude=<linters>
A comma-separated list of linters to skip.
-l, –linters
Show the list of configured linters.
-b, –base
Check all changed files from GIT_DIR, not just those in the current directory and down.
-a, –all
Scan all files, not just those that have changed.
-e, –every
Scan all files, not just those that have changed, from GIT_DIR. Short for -b -a
-w, –workspace
Scan the workspace [default]
-s, –staging
Scan the staging area (useful for pre-commit).
-c <path>, –config=<path>
Path to config file
-t, –bylinter
Group reports by linter first as they appear in the config file [default]
-f, –byfile
Group reports by file first, linter second
-d, –dryrun
Report what git-lint would do, but don’t actually do anything.
-q, –quiet
Produce a short report of file that failed to pass.
-h, –help
Print a short help message
-V, –verbose
Print a slightly more verbose long report
-v, –version
Print version information

OUTPUT

By default, the output is that of all the linters specified, in the order in which they appear in the configuration file, followed by every file specified, sorted ASCIIbetically. This order can be flipped (files first, then linters) with the --byfiles option.

git lint returns the maximal error code if any linters fail a pass, or zero if they all succeed.

CONFIGURATION

git lint uses a standard INI-style configuration file. Aside from the DEFAULT section, the name of each section is an alphanumeric token name for a linter, followed by configuration details for that linter. Standard details are:

  • output - Text to print before running a linter.
  • command - The actual command to run, minus the file path
  • match - A comma-separated list of extensions to match against the linter
  • print - If true, will prefix each line of output from the linter with the filename
  • condition - if “error”, the return code of the linter is the status of the pass. If “output,” any output will result in a failure.
  • comment - Text to include when running the --linters option