From d7e552e223686ee6fabe3a5893af74292f1bf586 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Thu, 16 Apr 2020 11:58:50 +0200 Subject: tests: add phpcs with minimal PSR12 config --- Makefile | 8 +++++++- composer.json | 3 ++- composer.lock | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- phpcs.xml | 23 +++++++++++++++++++++++ 4 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 phpcs.xml diff --git a/Makefile b/Makefile index 53ea1b1..a73b4d5 100644 --- a/Makefile +++ b/Makefile @@ -86,9 +86,10 @@ dist/w_cms_%.zip: all .default.env \ .gitignore \ .release-it.json \ - Makefile \ "composer*" \ + Makefile \ "package*" \ + phpcs.xml \ webpack.config.js # Generate the js bundles (and sourcemaps). @@ -151,6 +152,11 @@ buildclean: rm -rf $(js_srcmaps) rm -rf $(build_dir) +.PHONY: check +check: + @echo Running tests... + phpcs + # Touch files affected by the build environment to force the execution # of the corresponding targets. .PHONY: touch diff --git a/composer.json b/composer.json index ee39c84..6a11516 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,8 @@ "michelf/php-markdown": "^1.8" }, "require-dev": { - "sentry/sdk": "^2.0" + "sentry/sdk": "^2.0", + "squizlabs/php_codesniffer": "^3.5" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 73bc711..2f749cd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "dd0efdb33769c0ca504cbf4478c51fbf", + "content-hash": "e099652c0565f5b3cad14bc2132646d6", "packages": [ { "name": "altorouter/altorouter", @@ -1413,6 +1413,57 @@ ], "time": "2019-12-18T08:56:34+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.5.4", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "dceec07328401de6211037abbb18bda423677e26" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dceec07328401de6211037abbb18bda423677e26", + "reference": "dceec07328401de6211037abbb18bda423677e26", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "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": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2020-01-30T22:20:29+00:00" + }, { "name": "symfony/options-resolver", "version": "v4.4.2", diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..3bed678 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,23 @@ + + + The coding standard for Wcms. + + + index.php + app + app/view/templates/*\.php$ + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3