Skip to main content
Go to documentation navigation

How to use Lintje

Lintje is a command line tool. After installation Lintje can be called with the lintje command.

It’s recommended to add Lintje to the project Continuous Integration setup to lint the range of commits added by a Pull Request or push. See also the automated review for more usage examples.

Table of Contents

Validating commits

Lintje accepts a range of commits to check as arguments. If no arguments are given, Lintje will only check the last commit on the current branch. By default Lintje will also validate the current branch.

To validate a specific Git commit, pass in the commit SHA or selectors like HEAD~3. Any valid git log commit selector will work.

# Lint the most recent commit on the current branch:
# Which is the same as:
lintje HEAD

# Lint a specific commit:
lintje 3a561ef766c2acfe5da478697d91758110b8b24c

Validating commit ranges

Lintje can also validate a range of commits, like all commits in a Pull Request. The argument given to the lintje command should the range of commits that should be validated. Any valid git log commit range will work.

# Lint the last 5 commits:
lintje HEAD~5..HEAD

# Lint the difference between two branches:
lintje main..develop

Branch validation

Version 0.4.0

By default Lintje will validate the branch according to the branch rules. This validation type can be disabled by calling lintje with the --no-branch flag.

# Run Lintje without branch validation
lintje --no-branch

Commit message file validation

Version 0.1.0

To accommodate for the “commit-msg” Git hook, the --hook-message-file option allow you to configure where Lintje should read the commit message from. This is primarily used for the Git hook setup.

# Validate a specific commit message file
lintje --hook-message-file .git/COMMIT_MESSAGE


Version 0.7.0

Hints provide suggestions how to improve commits. For example, a commit may not link back to an issue. Lintje will suggest adding a reference to the relevant issue. Hints do not need to be resolved before Lintje will approve the commit.

To run Lintje without printing hints, use the --no-hints flag.

lintje --no-hints

Read more about how Lintje outputs hints in the terminal.

Colorized output

Version 0.7.0

Lintje can print the validation output with color to highlight important parts of the validation output.

At this time Lintje will not print the validation result with colorized output. When this feature becomes more stable it will be turned on by default.

# Print output with color
lintje --color

# Print output without color (default)
lintje --no-color

Colorized output can also be disabled with the NO_COLOR environment variable.

# Per command
NO_COLOR=true lintje

# Or set globally
export NO_COLOR=true

Exit codes

Lintje will exit with the following status codes in these situations: