diff --git a/Dockerfile b/Dockerfile index bd87c4a..8e083b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ RUN apk add --no-cache git && \ apk del --purge git && \ vendor/bin/phpcs --config-set \ installed_paths \ - "/usr/src/app/vendor/drupal/coder/coder_sniffer,/usr/src/app/vendor/escapestudios/symfony2-coding-standard,/usr/src/app/vendor/wp-coding-standards/wpcs,/usr/src/app/vendor/yiisoft/yii2-coding-standards,/usr/src/app/vendor/magento/marketplace-eqp,/usr/src/app/vendor/pheromone/phpcs-security-audit" && \ + "/usr/src/app/vendor/drupal/coder/coder_sniffer,/usr/src/app/vendor/escapestudios/symfony2-coding-standard,/usr/src/app/vendor/wp-coding-standards/wpcs,/usr/src/app/vendor/yiisoft/yii2-coding-standards,/usr/src/app/vendor/magento/marketplace-eqp,/usr/src/app/vendor/magento/magento-coding-standard,/usr/src/app/vendor/pheromone/phpcs-security-audit" && \ chown -R app:app . && \ rm -r ~/.composer diff --git a/Runner.php b/Runner.php index f926725..ca03146 100644 --- a/Runner.php +++ b/Runner.php @@ -1,5 +1,9 @@ config['config']['standard'])) { $extra_config_options[] = '--standard=' . $this->config['config']['standard']; @@ -106,13 +110,25 @@ public function run($files) ob_start(); // setup the code sniffer - $cli = new PHP_CodeSniffer_CLI(); - $cli->setCommandLineValues($extra_config_options); + $runner = new \PHP_CodeSniffer\Runner(); + $runner->config = new Config($extra_config_options); + $runner->init(); + + // setup the code sniffer + $runner->reporter = new Reporter($runner->config); // start the code sniffing - PHP_CodeSniffer_Reporting::startTiming(); - $cli->checkRequirements(); - $cli->process(); + Timing::startTiming(); + $runner->checkRequirements(); + + $todo = new FileList($runner->config, $runner->ruleset); + foreach ($todo as $path => $file) { + if ($file->ignored === false) { + $runner->processFile($file); + } + } + + $runner->reporter->printReports(); // clean up the output buffers (might be more that one) while (ob_get_level()) { diff --git a/composer.json b/composer.json index 790a593..b4fb5ab 100644 --- a/composer.json +++ b/composer.json @@ -4,25 +4,27 @@ "type": "package", "package": { "name": "magento/marketplace-eqp", - "version": "1.0.5", + "version": "4.0.0", "description": "A set of PHP_CodeSniffer rules and sniffs.", "license": "MIT", "source": { "url": "https://github.com/magento/marketplace-eqp.git", "type": "git", - "reference": "1.0.5" + "reference": "4.0.0" } } } }, "require": { - "squizlabs/php_codesniffer": "^2.9.1", + "squizlabs/php_codesniffer": "^3.5", "barracudanetworks/forkdaemon-php": "^1.0", "danielstjules/stringy": "^2.3", - "drupal/coder": "^8.2", - "escapestudios/symfony2-coding-standard": "^2.10", - "wp-coding-standards/wpcs": "^1.0.0", + "drupal/coder": "^8.3", + "escapestudios/symfony2-coding-standard": "^3.9", + "wp-coding-standards/wpcs": "^2.1", "yiisoft/yii2-coding-standards": "^2.0", + "magento/marketplace-eqp": "^4.0", + "magento/magento-coding-standard": "^4.0" "magento/marketplace-eqp": "^1.0", "pheromone/phpcs-security-audit": "^1.0" } diff --git a/composer.lock b/composer.lock index 61c5fed..467001a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "55fa673ad819714240c5b0af20c4b47a", + "content-hash": "cf98f1088cec2e6cdc42bc5230551404", "packages": [ { "name": "barracudanetworks/forkdaemon-php", - "version": "v1.1.0", + "version": "v1.1.1", "source": { "type": "git", "url": "https://github.com/barracudanetworks/forkdaemon-php.git", - "reference": "98307c172debec0ea982ef369634292d84bd5b2a" + "reference": "16c068748ce170ab167f288b116ac0d105f6185d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barracudanetworks/forkdaemon-php/zipball/98307c172debec0ea982ef369634292d84bd5b2a", - "reference": "98307c172debec0ea982ef369634292d84bd5b2a", + "url": "https://api.github.com/repos/barracudanetworks/forkdaemon-php/zipball/16c068748ce170ab167f288b116ac0d105f6185d", + "reference": "16c068748ce170ab167f288b116ac0d105f6185d", "shasum": "" }, "require": { @@ -40,7 +40,7 @@ "forking", "php" ], - "time": "2017-12-18T15:52:48+00:00" + "time": "2018-09-11T14:29:03+00:00" }, { "name": "danielstjules/stringy", @@ -100,22 +100,28 @@ }, { "name": "drupal/coder", - "version": "8.2.12", + "version": "8.3.6", "source": { "type": "git", "url": "https://git.drupalcode.org/project/coder.git", - "reference": "984c54a7b1e8f27ff1c32348df69712afd86b17f" + "reference": "4337ddf58d28dbdee4e1367bf71ee13393ab9820" }, "require": { "ext-mbstring": "*", - "php": ">=5.4.0", - "squizlabs/php_codesniffer": ">=2.8.1 <3.0", - "symfony/yaml": ">=2.0.0" + "php": ">=5.5.9", + "squizlabs/php_codesniffer": "^3.4.1", + "symfony/yaml": ">=2.0.5" }, "require-dev": { "phpunit/phpunit": ">=3.7 <6" }, "type": "phpcodesniffer-standard", + "autoload": { + "psr-0": { + "Drupal\\": "coder_sniffer/Drupal/", + "DrupalPractice\\": "coder_sniffer/DrupalPractice/" + } + }, "notification-url": "https://packagist.org/downloads/", "license": [ "GPL-2.0+" @@ -127,29 +133,35 @@ "phpcs", "standards" ], - "time": "2017-03-18T10:28:49+00:00" + "time": "2019-08-09T09:27:26+00:00" }, { "name": "escapestudios/symfony2-coding-standard", - "version": "2.11.0", + "version": "3.9.2", "source": { "type": "git", "url": "https://github.com/djoos/Symfony-coding-standard.git", - "reference": "4aea10ad53d1952b2cfd8f7c9afe5e481dd574bc" + "reference": "369b5f2579be6aed478ca3a4248619eab6e54e41" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/djoos/Symfony-coding-standard/zipball/4aea10ad53d1952b2cfd8f7c9afe5e481dd574bc", - "reference": "4aea10ad53d1952b2cfd8f7c9afe5e481dd574bc", + "url": "https://api.github.com/repos/djoos/Symfony-coding-standard/zipball/369b5f2579be6aed478ca3a4248619eab6e54e41", + "reference": "369b5f2579be6aed478ca3a4248619eab6e54e41", "shasum": "" }, "require": { - "squizlabs/php_codesniffer": "~2.0" + "squizlabs/php_codesniffer": "^3.3.1" + }, + "conflict": { + "squizlabs/php_codesniffer": "<3 || >=4" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "type": "phpcodesniffer-standard", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, "notification-url": "https://packagist.org/downloads/", @@ -159,30 +171,60 @@ "authors": [ { "name": "David Joos", - "email": "david.joos@escapestudios.com" + "email": "iam@davidjoos.com" }, { "name": "Community contributors", - "homepage": "https://github.com/djoos/Symfony2-coding-standard/graphs/contributors" + "homepage": "https://github.com/djoos/Symfony-coding-standard/graphs/contributors" } ], "description": "CodeSniffer ruleset for the Symfony 2+ coding standard", - "homepage": "https://github.com/djoos/Symfony2-coding-standard", + "homepage": "https://github.com/djoos/Symfony-coding-standard", "keywords": [ "Coding Standard", "Symfony2", "phpcs", "symfony" ], - "time": "2017-06-08T10:48:30+00:00" + "time": "2019-09-25T08:43:58+00:00" + }, + { + "name": "magento/magento-coding-standard", + "version": "4", + "source": { + "type": "git", + "url": "https://github.com/magento/magento-coding-standard.git", + "reference": "d24e0230a532e19941ed264f57db38fad5b1008a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/magento/magento-coding-standard/zipball/d24e0230a532e19941ed264f57db38fad5b1008a", + "reference": "d24e0230a532e19941ed264f57db38fad5b1008a", + "shasum": "" + }, + "require": { + "php": ">=5.6.0", + "squizlabs/php_codesniffer": "^3.4" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "OSL-3.0", + "AFL-3.0" + ], + "description": "A set of Magento specific PHP CodeSniffer rules.", + "time": "2019-08-06T15:58:37+00:00" }, { "name": "magento/marketplace-eqp", - "version": "1.0.5", + "version": "4.0.0", "source": { "type": "git", "url": "https://github.com/magento/marketplace-eqp.git", - "reference": "1.0.5" + "reference": "4.0.0" }, "type": "library", "license": [ @@ -224,64 +266,37 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.1", + "version": "3.5.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", + "reference": "65b12cdeaaa6cd276d4c3033a95b9b88b12701e7", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.1.2" + "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "bin": [ - "scripts/phpcs", - "scripts/phpcbf" + "bin/phpcs", + "bin/phpcbf" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "3.x-dev" } }, - "autoload": { - "classmap": [ - "CodeSniffer.php", - "CodeSniffer/CLI.php", - "CodeSniffer/Exception.php", - "CodeSniffer/File.php", - "CodeSniffer/Fixer.php", - "CodeSniffer/Report.php", - "CodeSniffer/Reporting.php", - "CodeSniffer/Sniff.php", - "CodeSniffer/Tokens.php", - "CodeSniffer/Reports/", - "CodeSniffer/Tokenizers/", - "CodeSniffer/DocGenerators/", - "CodeSniffer/Standards/AbstractPatternSniff.php", - "CodeSniffer/Standards/AbstractScopeSniff.php", - "CodeSniffer/Standards/AbstractVariableSniff.php", - "CodeSniffer/Standards/IncorrectPatternException.php", - "CodeSniffer/Standards/Generic/Sniffs/", - "CodeSniffer/Standards/MySource/Sniffs/", - "CodeSniffer/Standards/PEAR/Sniffs/", - "CodeSniffer/Standards/PSR1/Sniffs/", - "CodeSniffer/Standards/PSR2/Sniffs/", - "CodeSniffer/Standards/Squiz/Sniffs/", - "CodeSniffer/Standards/Zend/Sniffs/" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -293,25 +308,25 @@ } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", "keywords": [ "phpcs", "standards" ], - "time": "2017-05-22T02:43:20+00:00" + "time": "2019-10-28T04:36:32+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.9.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + "reference": "550ebaac289296ce228a706d0867afc34687e3f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", - "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/550ebaac289296ce228a706d0867afc34687e3f4", + "reference": "550ebaac289296ce228a706d0867afc34687e3f4", "shasum": "" }, "require": { @@ -323,7 +338,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -339,13 +354,13 @@ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, { "name": "Gert de Pagter", "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -356,20 +371,20 @@ "polyfill", "portable" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.9.0", + "version": "v1.12.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", - "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/b42a2f66e8f1b15ccf25652c3424265923eb4f17", + "reference": "b42a2f66e8f1b15ccf25652c3424265923eb4f17", "shasum": "" }, "require": { @@ -381,7 +396,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.9-dev" + "dev-master": "1.12-dev" } }, "autoload": { @@ -415,20 +430,20 @@ "portable", "shim" ], - "time": "2018-08-06T14:22:27+00:00" + "time": "2019-08-06T08:03:45+00:00" }, { "name": "symfony/yaml", - "version": "v4.1.4", + "version": "v4.3.5", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "b832cc289608b6d305f62149df91529a2ab3c314" + "reference": "41e16350a2a1c7383c4735aa2f9fce74cf3d1178" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/b832cc289608b6d305f62149df91529a2ab3c314", - "reference": "b832cc289608b6d305f62149df91529a2ab3c314", + "url": "https://api.github.com/repos/symfony/yaml/zipball/41e16350a2a1c7383c4735aa2f9fce74cf3d1178", + "reference": "41e16350a2a1c7383c4735aa2f9fce74cf3d1178", "shasum": "" }, "require": { @@ -447,7 +462,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.1-dev" + "dev-master": "4.3-dev" } }, "autoload": { @@ -474,31 +489,33 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-08-18T16:52:46+00:00" + "time": "2019-09-11T15:41:19+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "1.0.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "539c6d74e6207daa22b7ea754d6f103e9abb2755" + "reference": "bd9c33152115e6741e3510ff7189605b35167908" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/539c6d74e6207daa22b7ea754d6f103e9abb2755", - "reference": "539c6d74e6207daa22b7ea754d6f103e9abb2755", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/bd9c33152115e6741e3510ff7189605b35167908", + "reference": "bd9c33152115e6741e3510ff7189605b35167908", "shasum": "" }, "require": { - "php": ">=5.3", - "squizlabs/php_codesniffer": "^2.9.0 || ^3.0.2" + "php": ">=5.4", + "squizlabs/php_codesniffer": "^3.3.1" }, "require-dev": { - "phpcompatibility/php-compatibility": "*" + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", + "phpcompatibility/php-compatibility": "^9.0", + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.3 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -517,25 +534,25 @@ "standards", "wordpress" ], - "time": "2018-07-25T18:10:35+00:00" + "time": "2019-05-21T02:50:00+00:00" }, { "name": "yiisoft/yii2-coding-standards", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/yiisoft/yii2-coding-standards.git", - "reference": "1047aaefcce4cfb83e4987110a573d19706bc50d" + "reference": "b76c3f58b54c37624f4b17582971e71981b71122" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/yiisoft/yii2-coding-standards/zipball/1047aaefcce4cfb83e4987110a573d19706bc50d", - "reference": "1047aaefcce4cfb83e4987110a573d19706bc50d", + "url": "https://api.github.com/repos/yiisoft/yii2-coding-standards/zipball/b76c3f58b54c37624f4b17582971e71981b71122", + "reference": "b76c3f58b54c37624f4b17582971e71981b71122", "shasum": "" }, "require": { "php": ">=5.4.0", - "squizlabs/php_codesniffer": ">=2.3.1 <3.0" + "squizlabs/php_codesniffer": ">=3.2" }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -585,7 +602,7 @@ "framework", "yii" ], - "time": "2017-05-12T10:30:45+00:00" + "time": "2018-09-04T23:10:55+00:00" } ], "packages-dev": [], diff --git a/engine.php b/engine.php index b86b006..de1d250 100644 --- a/engine.php +++ b/engine.php @@ -1,7 +1,7 @@