Commitlint
This project is an implementation of the Conventional commits specification. This is inspired by the JS library pendant commitlint. The hook installation was inspired by elixir-pre-commit
Installation
If available in Hex, the package can be installed
by adding commitlint to your list of dependencies in mix.exs:
def deps do
[
{:commitlint, "~> 0.1.0", runtime: false, only: :dev}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/commitlint.
Configuration
The configuration is done in the config/config.exs file. The default configuration is:
config :commitlint,
allowed_types: [
"feat",
"fix",
"docs",
"style",
"refactor",
"perf",
"test",
"build",
"ci",
"chore",
"revert"
]
Usage
The package provides a mix task commit_lint. If you want to try it out, you can run:
echo "feat: add commit linting" | mix commit_lint # Should have exit error 0
echo "unknown: add commit linting" | mix commit_lint # Should have exit error 1
Upon compilation, the package will install a commit-msg hook in the .git/hooks directory. This will take care of
running the commit linting on every commit.