add: import code

портирован и слегка подправлен код из старого репозитория https://di9.ru/git/Voomra/Conventional-Commits
This commit is contained in:
2025-07-30 18:34:40 +03:00
commit eb901cae0f
14 changed files with 591 additions and 0 deletions

34
README.MD Normal file
View File

@@ -0,0 +1,34 @@
# Commit-lint plugin for Gradle
Плагин Gradle для проверки описаний коммитов на соответствие [соглашению о коммитах](https://di9.ru/git/Conventional-Commits/specification/src/branch/master/CONVENTIONAL_COMMITS.MD).
## Использование
Добавить git hook `commit-msg`:
```shell
#!/usr/bin/env sh
./gradlew --console=plain -q commitlint -PgitCommitMessageFile="$1"
```
| Параметр | Описание | По-умолчанию |
|:-------------------------|:--------------------------------|-----------------------|
| `-PgitCommitMessageFile` | Путь до файла сообщения коммита | `.git/COMMIT_EDITMSG` |
### Настройка
```groovy
commitlint {
types = ["build", "docs", "add", "tweak", "fix", "remove", "revert", "perf", "refac", "style", "test"]
contexts = ["git", "ide"]
excludes = ["^wip\$"]
maxLengthLine = 72
}
```
| Настройка | Описание | По-умолчанию |
|:----------------|:------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
| `types` | Перечисление допустимых типов коммитов | _весь перечень типов из [документа соглашения](https://di9.ru/git/Conventional-Commits/specification/src/branch/master/CONVENTIONAL_COMMITS.MD)_ |
| `contexts` | Перечисление допустимых контекстов | _весь перечень контекстов из [документа соглашения](https://di9.ru/git/Conventional-Commits/specification/src/branch/master/CONVENTIONAL_COMMITS.MD)_ |
| `excludes` | Перечисление шаблонов для исключений | `^wip$` |
| `maxLengthLine` | Максимальная длинна первой строки коммита | 72 |