Add "PHP Coding Standards Fixer" tool to project
This commit is contained in:
parent
602b9b95cc
commit
8e0239521d
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/.php-cs-fixer.cache
|
27
.php-cs-fixer.dist.php
Normal file
27
.php-cs-fixer.dist.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PhpCsFixer\Config;
|
||||
use PhpCsFixer\Finder;
|
||||
|
||||
require_once __DIR__ . '/tools/php-cs-fixer/vendor/autoload.php';
|
||||
|
||||
$rules = [
|
||||
'@PER-CS' => true,
|
||||
'@PHP82Migration' => true,
|
||||
// TODO configure other rules
|
||||
];
|
||||
|
||||
$finder = Finder::create();
|
||||
$finder->files();
|
||||
$finder->in(dirs: __DIR__);
|
||||
$finder->exclude(dirs: ['core/vendor', 'tools', 'website/var', 'website/vendor']);
|
||||
$finder->append(iterator: [__FILE__, __DIR__ . '/website/bin/console']);
|
||||
|
||||
$config = new Config(name: 'Quintolin coding standard');
|
||||
$config->setFinder(finder: $finder);
|
||||
$config->setRiskyAllowed(isRiskyAllowed: true);
|
||||
$config->setRules(rules: $rules);
|
||||
|
||||
return $config;
|
7
Makefile
7
Makefile
|
@ -21,3 +21,10 @@ clean_cache:
|
|||
clean_logs:
|
||||
rm --force --recursive --verbose website/var/log
|
||||
|
||||
.PHONY: install_php_cs_fixer
|
||||
install_php_cs_fixer:
|
||||
composer --quiet --working-dir=tools/php-cs-fixer install
|
||||
|
||||
.PHONY: fix_coding_style
|
||||
fix_coding_style: install_php_cs_fixer
|
||||
tools/php-cs-fixer/vendor/bin/php-cs-fixer fix -vvv
|
||||
|
|
|
@ -45,4 +45,5 @@ This project is published to multiple core-sharing portals:
|
|||
- [doc](doc/README.md): developer documentation
|
||||
- [legacy](legacy/README.md): History and source code of previous versions of
|
||||
the game
|
||||
- `tools`: developer tools
|
||||
- [website](website/README.md): website and UI
|
||||
|
|
1
tools/php-cs-fixer/.gitignore
vendored
Normal file
1
tools/php-cs-fixer/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/vendor/
|
18
tools/php-cs-fixer/composer.json
Normal file
18
tools/php-cs-fixer/composer.json
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "krzysztof-sikorski/php-cs-fixer-bundle",
|
||||
"description": "Dummy project to load php-cs-fixer package.",
|
||||
"type": "project",
|
||||
"license": "MIT",
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^v3.42"
|
||||
},
|
||||
"minimum-stability": "stable",
|
||||
"prefer-stable": true,
|
||||
"config": {
|
||||
"preferred-install": "dist",
|
||||
"optimize-autoloader": true,
|
||||
"sort-packages": true,
|
||||
"notify-on-install": false,
|
||||
"platform-check": true
|
||||
}
|
||||
}
|
1840
tools/php-cs-fixer/composer.lock
generated
Normal file
1840
tools/php-cs-fixer/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
Reference in a new issue