mirror of
https://github.com/ToxicCrack/PrintABrick.git
synced 2025-05-16 12:20:09 -07:00
Setup php-cs-fixer pre-commit hook
This commit is contained in:
parent
dcb475407b
commit
3ede847697
18
.php_cs
Normal file
18
.php_cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
$finder = PhpCsFixer\Finder::create()
|
||||||
|
->in(__DIR__.'/src');
|
||||||
|
|
||||||
|
return PhpCsFixer\Config::create()
|
||||||
|
->setRules([
|
||||||
|
'@Symfony' => true,
|
||||||
|
'combine_consecutive_unsets' => true,
|
||||||
|
'linebreak_after_opening_tag' => true,
|
||||||
|
'no_multiline_whitespace_before_semicolons' => true,
|
||||||
|
'no_useless_else' => true,
|
||||||
|
'no_useless_return' => true,
|
||||||
|
'ordered_imports' => true,
|
||||||
|
'phpdoc_order' => true,
|
||||||
|
'array_syntax' => array('syntax' => 'short'),
|
||||||
|
])
|
||||||
|
->setFinder($finder);
|
1
.php_cs.cache
Normal file
1
.php_cs.cache
Normal file
File diff suppressed because one or more lines are too long
30
bin/php-cs-fixer-hook.sh
Normal file
30
bin/php-cs-fixer-hook.sh
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# To use this hook you need to install php-cs-fixer
|
||||||
|
# Copy this file to ./git/hooks/pre-commit to get it working.
|
||||||
|
|
||||||
|
ROOT="/"
|
||||||
|
|
||||||
|
echo "php-cs-fixer pre commit hook start"
|
||||||
|
|
||||||
|
PHP_CS_FIXER="vendor/bin/php-cs-fixer"
|
||||||
|
HAS_PHP_CS_FIXER=false
|
||||||
|
|
||||||
|
if [ -x vendor/bin/php-cs-fixer ]; then
|
||||||
|
HAS_PHP_CS_FIXER=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
if $HAS_PHP_CS_FIXER; then
|
||||||
|
git status --porcelain | grep -e '^[AM]\(.*\).php$' | cut -c 3- | while read line; do
|
||||||
|
$PHP_CS_FIXER fix --config-file=$ROOT/.php_cs --verbose "$line";
|
||||||
|
git add "$line";
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
echo "Please install php-cs-fixer, e.g.:"
|
||||||
|
echo ""
|
||||||
|
echo " composer require --dev friendsofphp/php-cs-fixer"
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "php-cs-fixer pre commit hook finish"
|
@ -28,7 +28,8 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"sensio/generator-bundle": "^3.0",
|
"sensio/generator-bundle": "^3.0",
|
||||||
"symfony/phpunit-bridge": "^3.0"
|
"symfony/phpunit-bridge": "^3.0",
|
||||||
|
"friendsofphp/php-cs-fixer": "^2.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"symfony-scripts": [
|
"symfony-scripts": [
|
||||||
|
177
composer.lock
generated
177
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "a13e1582c61b7faed478722b500ee8a9",
|
"content-hash": "54b7bfc7ee85ba1c5bb4cd9f7d9cfa60",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "doctrine/annotations",
|
"name": "doctrine/annotations",
|
||||||
@ -2478,6 +2478,123 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
|
{
|
||||||
|
"name": "friendsofphp/php-cs-fixer",
|
||||||
|
"version": "v2.0.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
|
||||||
|
"reference": "f3baf72eb2f58bf275b372540f5b47d25aed910f"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/f3baf72eb2f58bf275b372540f5b47d25aed910f",
|
||||||
|
"reference": "f3baf72eb2f58bf275b372540f5b47d25aed910f",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-tokenizer": "*",
|
||||||
|
"php": "^5.3.6 || >=7.0 <7.2",
|
||||||
|
"sebastian/diff": "^1.1",
|
||||||
|
"symfony/console": "^2.3 || ^3.0",
|
||||||
|
"symfony/event-dispatcher": "^2.1 || ^3.0",
|
||||||
|
"symfony/filesystem": "^2.4 || ^3.0",
|
||||||
|
"symfony/finder": "^2.2 || ^3.0",
|
||||||
|
"symfony/polyfill-php54": "^1.0",
|
||||||
|
"symfony/process": "^2.3 || ^3.0",
|
||||||
|
"symfony/stopwatch": "^2.5 || ^3.0"
|
||||||
|
},
|
||||||
|
"conflict": {
|
||||||
|
"hhvm": "<3.9"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"gecko-packages/gecko-php-unit": "^2.0",
|
||||||
|
"phpunit/phpunit": "^4.5|^5",
|
||||||
|
"satooshi/php-coveralls": "^1.0"
|
||||||
|
},
|
||||||
|
"bin": [
|
||||||
|
"php-cs-fixer"
|
||||||
|
],
|
||||||
|
"type": "application",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"PhpCsFixer\\": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Dariusz Rumiński",
|
||||||
|
"email": "dariusz.ruminski@gmail.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Fabien Potencier",
|
||||||
|
"email": "fabien@symfony.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "A tool to automatically fix PHP code style",
|
||||||
|
"time": "2016-12-01T06:18:06+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "sebastian/diff",
|
||||||
|
"version": "1.4.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||||
|
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e",
|
||||||
|
"reference": "13edfd8706462032c2f52b4b862974dd46b71c9e",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "~4.8"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.4-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"classmap": [
|
||||||
|
"src/"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"BSD-3-Clause"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Kore Nordmann",
|
||||||
|
"email": "mail@kore-nordmann.de"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Sebastian Bergmann",
|
||||||
|
"email": "sebastian@phpunit.de"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Diff implementation",
|
||||||
|
"homepage": "https://github.com/sebastianbergmann/diff",
|
||||||
|
"keywords": [
|
||||||
|
"diff"
|
||||||
|
],
|
||||||
|
"time": "2015-12-08T07:14:41+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "sensio/generator-bundle",
|
"name": "sensio/generator-bundle",
|
||||||
"version": "v3.1.2",
|
"version": "v3.1.2",
|
||||||
@ -2587,6 +2704,64 @@
|
|||||||
"description": "Symfony PHPUnit Bridge",
|
"description": "Symfony PHPUnit Bridge",
|
||||||
"homepage": "https://symfony.com",
|
"homepage": "https://symfony.com",
|
||||||
"time": "2016-12-12T13:31:08+00:00"
|
"time": "2016-12-12T13:31:08+00:00"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "symfony/polyfill-php54",
|
||||||
|
"version": "v1.3.0",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/symfony/polyfill-php54.git",
|
||||||
|
"reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/90e085822963fdcc9d1c5b73deb3d2e5783b16a0",
|
||||||
|
"reference": "90e085822963fdcc9d1c5b73deb3d2e5783b16a0",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.3"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "1.3-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Symfony\\Polyfill\\Php54\\": ""
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"bootstrap.php"
|
||||||
|
],
|
||||||
|
"classmap": [
|
||||||
|
"Resources/stubs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Nicolas Grekas",
|
||||||
|
"email": "p@tchwork.com"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Symfony Community",
|
||||||
|
"homepage": "https://symfony.com/contributors"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions",
|
||||||
|
"homepage": "https://symfony.com",
|
||||||
|
"keywords": [
|
||||||
|
"compatibility",
|
||||||
|
"polyfill",
|
||||||
|
"portable",
|
||||||
|
"shim"
|
||||||
|
],
|
||||||
|
"time": "2016-11-14T01:06:16+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user