chore: add php-commitizen (#76)

Adds PHP Commitizen for automated commit message formatting.

fix #39
This commit is contained in:
Ben Goldsworthy 2021-04-12 21:14:13 +01:00 committed by GitHub
parent 50115fb6c9
commit 5fa3e1403e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 180 additions and 12 deletions

View file

@ -29,3 +29,4 @@ node_modules
*.zip
authors.txt
composer.*
.php-commitizen.php

30
.php-commitizen.php Normal file
View file

@ -0,0 +1,30 @@
<?php
return [
'type' => [
'lengthMin' => 1, // Min length of the type
'lengthMax' => 8, // Max length of the type
'acceptExtra' => false, // Allow adding types not listed in 'values' key
'values' => ['feat', 'fix', 'refactor', 'style', 'docs', 'chore', 'test', 'perf', 'build', 'ci'], // All the values usable as type
],
'scope' => [
'lengthMin' => 0, // Min length of the scope
'lengthMax' => 10, // Max length of the scope
'acceptExtra' => true, // Allow adding scopes not listed in 'values' key
'values' => [], // All the values usable as scope
],
'description' => [
'lengthMin' => 1, // Min length of the description
'lengthMax' => 44, // Max length of the description
],
'subject' => [
'lengthMin' => 1, // Min length of the subject
'lengthMax' => 50, // Max length of the subject
],
'body' => [
'wrap' => 72, // Wrap the body at 72 characters
],
'footer' => [
'wrap' => 72, // Wrap the footer at 72 characters
],
];

View file

@ -5,33 +5,39 @@ request the best chance of being accepted:
# Requesting Features/Reporting Bugs
- To request a new feature or to report a bug, create an
[Issue](https://github.com/markcheret/footnotes/issues/new/choose) and choose
the correct template
- To request a new feature or to report a bug, create an [Issue][new-issue] and
choose the correct template
# Contributing Code
- **footnotes** uses [GitHub Flow](https://githubflow.github.io/)
- **footnotes** uses [GitHub Flow][github-flow]
- branch off of `main` to start developing (`git checkout -b <your branch>`)
- ensure that your new branch has a descriptive name
- create a remote copy of your new branch (`git push`)
- create a draft [pull request](https://github.com/markcheret/footnotes/compare)
to merge your branch with `main` — tag any related Issues, and if they are
assigned to a Project board, this will automatically move them into the
In Progress bucket
- create a draft [pull request][pull-request] to merge your branch with `main`
tag any related Issues, and if they are assigned to a Project board, this will
automatically move them into the In Progress bucket
- when you think you're finished, un-draft your pull request — if the PR is
assigned to a Project board, this will automatically move it and any related
Issues into the Review in progress bucket
# Commits
- **footnotes** uses [Conventional Commits](https://www.conventionalcommits.org)
- **footnotes** uses [Conventional Commits][conventional-commits]
- we use [PHP Commitizen][php-commitizen] to automate this - use `composer commit`
- keep individual commits as small as possible
# Versioning
- **footnotes** uses [Semantic Versioning](https://semver.org/)
- **footnotes** uses [Semantic Versioning][semver]
# Translating
- Translations are welcome!
[new-issue]: https://github.com/markcheret/footnotes/issues/new/choose
[github-flow]: https://githubflow.github.io/
[pull-request]: https://github.com/markcheret/footnotes/compare
[conventional-commits]: https://www.conventionalcommits.org
[php-commitizen]: https://github.com/conventional-commits/php-commitizen
[semver]: https://semver.org/

View file

@ -11,11 +11,14 @@
"lint-css": "echo TODO",
"lint-js": "echo TODO",
"docs": "./vendor/bin/phpdoc -d . -t ./docs --ignore vendor/",
"commit": "./vendor/bin/php-commitizen commit -- ./.php-commitizen.php",
"post-install-cmd": "./_tools/setup.sh"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"wp-coding-standards/wpcs": "^2.3",
"phpdocumentor/phpdocumentor": "^3.0"
"phpdocumentor/phpdocumentor": "^3.0",
"damianopetrungaro/php-commitizen": "^0.2.0",
"marcocesarato/php-conventional-changelog": "^1.9"
}
}

130
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "96b80176526406b01227fcaef2a4c2fc",
"content-hash": "c15a58a62ba5d8b2d7f3273717a8381a",
"packages": [],
"packages-dev": [
{
@ -80,6 +80,61 @@
],
"time": "2020-11-11T10:22:58+00:00"
},
{
"name": "damianopetrungaro/php-commitizen",
"version": "v0.2.0",
"source": {
"type": "git",
"url": "https://github.com/conventional-commits/php-commitizen.git",
"reference": "985283538f013c37146b2ec83812eeef2ff9d73c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/conventional-commits/php-commitizen/zipball/985283538f013c37146b2ec83812eeef2ff9d73c",
"reference": "985283538f013c37146b2ec83812eeef2ff9d73c",
"shasum": ""
},
"require": {
"symfony/console": "^4 || ^5"
},
"require-dev": {
"phpspec/prophecy-phpunit": "^2.0",
"phpunit/phpunit": "^9"
},
"bin": [
"php-commitizen"
],
"type": "library",
"autoload": {
"psr-4": {
"Damianopetrungaro\\PHPCommitizen\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Damiano Petrungaro",
"email": "damianopetrungaro@gmail.com"
}
],
"description": "Help writing Git commit following conventional commit specs",
"keywords": [
"atomic",
"atomic commit",
"commit",
"conventional commit",
"conventionalcommit",
"git"
],
"support": {
"issues": "https://github.com/conventional-commits/php-commitizen/issues",
"source": "https://github.com/conventional-commits/php-commitizen/tree/v0.2.0"
},
"time": "2020-07-15T23:51:42+00:00"
},
{
"name": "dealerdirect/phpcodesniffer-composer-installer",
"version": "v0.7.1",
@ -1343,6 +1398,79 @@
],
"time": "2020-10-31T13:45:51+00:00"
},
{
"name": "marcocesarato/php-conventional-changelog",
"version": "v1.9.9",
"source": {
"type": "git",
"url": "https://github.com/marcocesarato/php-conventional-changelog.git",
"reference": "072ca71c733cf82dae8e6523aa40f4133c288f8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/marcocesarato/php-conventional-changelog/zipball/072ca71c733cf82dae8e6523aa40f4133c288f8c",
"reference": "072ca71c733cf82dae8e6523aa40f4133c288f8c",
"shasum": ""
},
"require": {
"php": ">=7.1.3",
"symfony/console": "^4 || ^5"
},
"require-dev": {
"brainmaestro/composer-git-hooks": "^2.8",
"friendsofphp/php-cs-fixer": "^2.18"
},
"bin": [
"conventional-changelog"
],
"type": "library",
"extra": {
"hooks": {
"pre-commit": "composer fix-cs",
"pre-push": "composer check-cs",
"post-merge": "composer install"
}
},
"autoload": {
"psr-4": {
"ConventionalChangelog\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"GPL-3.0-or-later"
],
"authors": [
{
"name": "Marco Cesarato",
"email": "cesarato.developer@gmail.com"
}
],
"description": "Generate changelogs and release notes from a project's commit messages and metadata and automate versioning with semver.org and conventionalcommits.org",
"keywords": [
"changelog",
"commit",
"commits",
"convention",
"conventional",
"conventional-changelog",
"conventional-changelog-preset",
"conventional-commit",
"conventional-commits",
"conventionalcommits",
"generation",
"git",
"history",
"php",
"readme",
"tag"
],
"support": {
"issues": "https://github.com/marcocesarato/php-conventional-changelog/issues",
"source": "https://github.com/marcocesarato/php-conventional-changelog/tree/v1.9.9"
},
"time": "2021-04-02T12:29:26+00:00"
},
{
"name": "monolog/monolog",
"version": "2.2.0",