Add "PHP Coding Standards Fixer" tool to project

This commit is contained in:
Krzysztof Sikorski 2023-12-27 04:57:08 +01:00
parent 602b9b95cc
commit 8e0239521d
Signed by: krzysztof-sikorski
GPG key ID: 4EB564BD08FE8476
7 changed files with 1895 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.php-cs-fixer.cache

27
.php-cs-fixer.dist.php Normal file
View 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;

View file

@ -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

View file

@ -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
View file

@ -0,0 +1 @@
/vendor/

View 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

File diff suppressed because it is too large Load diff