From ef7773c3c7f5171a264f097eba20a98d750f2354 Mon Sep 17 00:00:00 2001 From: Thomas LEFEBVRE Date: Mon, 4 Mar 2024 23:00:22 +0100 Subject: [PATCH] add codesniffer --- .gitignore | 5 +++ Makefile | 2 +- composer.json | 1 + composer.lock | 82 +++++++++++++++++++++++++++++++++++++++++++++++++- phpcs.xml.dist | 19 ++++++++++++ symfony.lock | 12 ++++++++ 6 files changed, 119 insertions(+), 2 deletions(-) create mode 100644 phpcs.xml.dist diff --git a/.gitignore b/.gitignore index 7aa9e2f..c5b6e97 100755 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,8 @@ phpstan.neon /.php-cs-fixer.php /.php-cs-fixer.cache ###< friendsofphp/php-cs-fixer ### + +###> squizlabs/php_codesniffer ### +/.phpcs-cache +/phpcs.xml +###< squizlabs/php_codesniffer ### diff --git a/Makefile b/Makefile index 365b682..91804b0 100755 --- a/Makefile +++ b/Makefile @@ -300,7 +300,7 @@ report-code-coverage: ## Updates code coverage on coveralls.io. Note: COVERALLS_ @make exec-bash cmd="export COVERALLS_REPO_TOKEN=${COVERALLS_REPO_TOKEN} && php ./vendor/bin/php-coveralls -v --coverage_clover reports/clover.xml --json_path reports/coverals.json" phpcs: ## Runs PHP CodeSniffer - @make exec-bash cmd="./vendor/bin/phpcs --version && ./vendor/bin/phpcs --standard=PSR12 --colors -p src tests" + @make exec-bash cmd="./vendor/bin/phpcs --version && ./vendor/bin/phpcs --standard=PSR12 --colors -p src tests/Unit tests/Functional" ecs: ## Runs Easy Coding Standard tool @make exec-bash cmd="./vendor/bin/ecs --version && ./vendor/bin/ecs --clear-cache check src tests/Unit tests/Functional" diff --git a/composer.json b/composer.json index a28e8c4..2504ec8 100755 --- a/composer.json +++ b/composer.json @@ -102,6 +102,7 @@ "phpstan/phpstan-phpunit": "^1.3", "phpstan/phpstan-symfony": "^1.3", "phpunit/phpunit": "^9.5", + "squizlabs/php_codesniffer": "*", "symfony/browser-kit": "6.4.*", "symfony/css-selector": "6.4.*", "symfony/debug-bundle": "6.4.*", diff --git a/composer.lock b/composer.lock index 66a83e9..ca9128c 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "3e76112b602bf4f2fc99739bb4d6db07", + "content-hash": "dd661e2a2c26a16b1f7a1001945491bc", "packages": [ { "name": "composer/semver", @@ -9797,6 +9797,86 @@ ], "time": "2020-09-28T06:39:44+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.9.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" + }, + "bin": [ + "bin/phpcbf", + "bin/phpcs" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" + }, + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2024-02-16T15:06:51+00:00" + }, { "name": "symfony/browser-kit", "version": "v6.4.3", diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 0000000..89195e2 --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,19 @@ + + + + + + + + + + + + bin/ + config/ + public/ + src/ + tests/ + + diff --git a/symfony.lock b/symfony.lock index 57b998e..0a2f470 100644 --- a/symfony.lock +++ b/symfony.lock @@ -64,6 +64,18 @@ "tests/bootstrap.php" ] }, + "squizlabs/php_codesniffer": { + "version": "3.9", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "3.6", + "ref": "1019e5c08d4821cb9b77f4891f8e9c31ff20ac6f" + }, + "files": [ + "phpcs.xml.dist" + ] + }, "symfony/asset-mapper": { "version": "6.4", "recipe": {