Skip to content

Update PHPCS to 3.5 and update all standards #76

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
28 changes: 22 additions & 6 deletions Runner.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

use PHP_CodeSniffer\Files\FileList;
use PHP_CodeSniffer\Reporter;
use PHP_CodeSniffer\Util\Timing;
use PHP_CodeSniffer\Config;
use Stringy\Stringy as S;

class Runner
Expand Down Expand Up @@ -82,7 +86,7 @@ public function run($files)
try {
$resultFile = tempnam(sys_get_temp_dir(), 'phpcodesniffer');

$extra_config_options = array('--report=json', '--report-file=' . $resultFile);
$extra_config_options = array('--report-json='.$resultFile);

if (isset($this->config['config']['standard'])) {
$extra_config_options[] = '--standard=' . $this->config['config']['standard'];
Expand All @@ -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()) {
Expand Down
14 changes: 8 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
Loading