1
This repository has been archived on 2025-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
Files
go-commitlint/README.MD
Voomra af99bebf91 add: import code
портирован код из старого репозитория https://di9.ru/git/Voomra/Conventional-Commits
2025-07-30 18:44:50 +03:00

52 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Commit-lint tool
Программа на Go для проверки описаний коммитов на соответствие [соглашению о коммитах](https://di9.ru/git/Conventional-Commits/specification/src/branch/master/CONVENTIONAL_COMMITS.MD).
## Использование
Добавить git hook `commit-msg`:
```shell
#!/usr/bin/env sh
commitlint -commitMessage="$1" -config="commitlint.json"
```
| Параметр | Описание | По-умолчанию |
|:-----------------|:--------------------------------|-----------------------|
| `-commitMessage` | Путь до файла сообщения коммита | `.git/COMMIT_EDITMSG` |
| `-config` | Путь до файла настроек | `commitlint.json` |
### Настройка
Настройка по-умолчанию считывается из файла `commitlint.json`, который находится в корне репозитория
```json
{
"types": [ "build", "docs", "pref", "refac", "revert", "style", "test" ],
"contexts": [ "git", "ide" ],
"excludes": [ "^wip$" ],
"maxLengthLine": 72
}
```
| Настройка | Описание |
|:----------------|:------------------------------------------|
| `types` | Перечисление допустимых типов коммитов |
| `contexts` | Перечисление допустимых контекстов |
| `excludes` | Перечисление шаблонов для исключений |
| `maxLengthLine` | Максимальная длинна первой строки коммита |
## Сборка
Для Linux:
```shell
make build-linux
```
Для Windows:
```shell
make build-windows
```