-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit acf3cf9
Showing
29 changed files
with
3,462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/vendor/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
return [ | ||
'type' => [ | ||
'lengthMin' => 1, | ||
'lengthMax' => 5, | ||
'acceptExtra' => false, | ||
'values' => ['feat', 'fix'], | ||
], | ||
'scope' => [ | ||
'lengthMin' => 0, | ||
'lengthMax' => 10, | ||
'acceptExtra' => true, | ||
'values' => [], | ||
], | ||
'description' => [ | ||
'lengthMin' => 1, | ||
'lengthMax' => 44, | ||
], | ||
'subject' => [ | ||
'lengthMin' => 1, | ||
'lengthMax' => 50, | ||
], | ||
'body' => [ | ||
'wrap' => 72, | ||
], | ||
'footer' => [ | ||
'wrap' => 72, | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
build: | ||
environment: | ||
php: | ||
version: 7.1 | ||
version: 7.2 | ||
tests: | ||
override: | ||
- | ||
command: 'vendor/bin/phpunit --coverage-clover=coverage-file' | ||
coverage: | ||
file: 'coverage-file' | ||
format: 'clover' | ||
checks: | ||
php: | ||
code_rating: true | ||
filter: | ||
excluded_paths: | ||
- "tests/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Damiano Petrungaro | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
# PHP Commitizen | ||
|
||
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/?branch=master) | ||
[![Code Coverage](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/?branch=master) | ||
[![Build Status](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/badges/build.png?b=master)](https://scrutinizer-ci.com/g/damianopetrungaro/php-commitizen/build-status/master) | ||
|
||
Commitizen is a tool built for create good commits for a clean and readable git history. | ||
|
||
This tool follow the [Conventional Commit specs](https://conventionalcommits.org/) and some best practices described in [this slides](https://slides.com/damianopetrungaro/working-with-git) | ||
|
||
# Installation and usage | ||
|
||
You can install it easily with composer | ||
|
||
`$ php composer.phar require --dev damianopetrungaro/php-commitizen` | ||
|
||
Usage is simple too | ||
|
||
`$ php vendor/bin/php-commitizen commit` | ||
|
||
You can also | ||
- pass a flag for add all the file to the stage: `-a` | ||
- specify a custom configuration file adding the file path as argument | ||
|
||
You can ask for more information using: `$ php vendor/bin/php-commitizen commit --help` | ||
|
||
# Configuration file | ||
|
||
The configuration file must return an array (or partial override) | ||
|
||
``` | ||
<?php | ||
return [ | ||
'type' => [ | ||
'lengthMin' => 1, // Min length of the type | ||
'lengthMax' => 5, // Max length of the type | ||
'acceptExtra' => false, // Allow adding types not listed in 'values' key | ||
'values' => ['feat', 'fix'], // 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 | ||
], | ||
]; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Damianopetrungaro\PHPCommitizen\CreateConventionalCommit; | ||
use Symfony\Component\Console\Application; | ||
use Symfony\Component\Console\Output\ConsoleOutput; | ||
|
||
foreach ([__DIR__ . '/../../autoload.php', __DIR__ . '/../vendor/autoload.php', __DIR__ . '/vendor/autoload.php'] as $autoloadFile) { | ||
if (file_exists($autoloadFile)) { | ||
require $autoloadFile; | ||
break; | ||
} | ||
} | ||
|
||
try { | ||
$configuration = require __DIR__ . '/../.php-commitizen.php'; | ||
$app = new Application('PHP Commitizen'); | ||
$app->add(new \Damianopetrungaro\PHPCommitizen\CommitCommand($configuration, new CreateConventionalCommit())); | ||
$app->run(); | ||
} catch (Throwable $e) { | ||
(new ConsoleOutput())->writeln("<error>{$e->getMessage()}</error>"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{ | ||
"name": "damianopetrungaro/php-commitizen", | ||
"description": "Help writing Git commit following conventional commit specs", | ||
"keywords": [ | ||
"git", | ||
"commit", | ||
"conventionalcommit", | ||
"conventional commit", | ||
"atomic commit", | ||
"atomic" | ||
], | ||
"type": "library", | ||
"require": { | ||
"roave/security-advisories": "dev-master", | ||
"symfony/console": "^4.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^7.0", | ||
"php-mock/php-mock-prophecy": "^0.0.2" | ||
}, | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Damiano Petrungaro", | ||
"email": "damianopetrungaro@gmail.com" | ||
} | ||
], | ||
"autoload": { | ||
"psr-4": { | ||
"Damianopetrungaro\\PHPCommitizen\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"Damianopetrungaro\\PHPCommitizen\\": "tests/Unit" | ||
} | ||
}, | ||
"bin": [ | ||
"bin/php-commitizen" | ||
] | ||
} |
Oops, something went wrong.