From 98acdd0931d93782813b2cb8cc0b2ae3e6fbb21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Danyi?= Date: Fri, 26 Jan 2018 14:24:13 +0100 Subject: [PATCH] * teamcity report added --- TeamCityCsReport.php | 55 +++++++++++++++++++++++++++++++++++++++ composer.json | 4 ++- composer.lock | 61 ++++++++++++-------------------------------- 3 files changed, 75 insertions(+), 45 deletions(-) create mode 100644 TeamCityCsReport.php diff --git a/TeamCityCsReport.php b/TeamCityCsReport.php new file mode 100644 index 0000000..d74461c --- /dev/null +++ b/TeamCityCsReport.php @@ -0,0 +1,55 @@ + $lineErrors) { + foreach ($lineErrors as $column => $colErrors) { + foreach ($colErrors as $error) { + echo sprintf( + '##teamcity[testFailed name=\'%s\' message=\'line %d, col %d, %s (%s) %s\']', + $file, + $line, + $column, + ($error['type'] === 'ERROR' ? 'Error' : 'Warning'), + $error['source'], + str_replace('\'', '|\'', $error['message']) + ) . PHP_EOL; + } + } + } + + echo sprintf('##teamcity[testFinished name=\'%s\']', $file) . PHP_EOL; + + return true; + } + + public function generate( + $cachedData, + $totalFiles, + $totalErrors, + $totalWarnings, + $totalFixable, + $showSources = false, + $width = 80, + $interactive = false, + $toScreen = true + ) { + echo '##teamcity[testSuiteStarted name=\'phpcs\']' . PHP_EOL; + echo $cachedData; + echo '##teamcity[testSuiteFinished name=\'phpcs\']' . PHP_EOL; + } + +} diff --git a/composer.json b/composer.json index b78a41c..98d6376 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ "require-dev": { "filp/whoops": "^2.1.7", "phpunit/phpunit": "^6.0.8 || ^5.7.15", - "squizlabs/php_codesniffer": "^2.8.1", + "squizlabs/php_codesniffer": "^3.0", "zendframework/zend-expressive-tooling": "^0.4.5", "zfcampus/zf-development-mode": "^3.1" }, @@ -52,11 +52,13 @@ ], "clear-config-cache": "php bin/clear-config-cache.php", "cs-check": "phpcs", + "cs-check-ci": "phpcs --no-colors --report=TeamCityCsReport.php", "cs-fix": "phpcbf", "serve": "php -S 0.0.0.0:8888 -t public index.php", "test": "phpunit --colors=always", "test-coverage": "phpunit --colors=always --coverage-clover clover.xml", "test-coverage-html": "phpunit --colors=always --coverage-html test/coverage", + "test-coverage-ci": "phpunit --colors=always --coverage-html test/coverage --teamcity", "upload-coverage": "coveralls -v" } } diff --git a/composer.lock b/composer.lock index ed438c4..604406b 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": "6fb0545051f1b3db45bd70bffd15dc3e", + "content-hash": "07e2b3690d8d7d3e264618d3236c754b", "packages": [ { "name": "container-interop/container-interop", @@ -386,12 +386,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "402a514551804df5b4b2150f217e23a15408795a" + "reference": "eca509e364dcea7b7f41f9452d575684cc8e3fb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/402a514551804df5b4b2150f217e23a15408795a", - "reference": "402a514551804df5b4b2150f217e23a15408795a", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/eca509e364dcea7b7f41f9452d575684cc8e3fb4", + "reference": "eca509e364dcea7b7f41f9452d575684cc8e3fb4", "shasum": "" }, "conflict": { @@ -446,7 +446,7 @@ "phpxmlrpc/extras": "<0.6.1", "pusher/pusher-php-server": "<2.2.1", "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", - "shopware/shopware": "<5.2.25", + "shopware/shopware": "<5.3.7", "silverstripe/cms": ">=3,<=3.0.11|>=3.1,<3.1.11", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", "silverstripe/framework": ">=3,<3.3", @@ -475,7 +475,7 @@ "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", "thelia/backoffice-default-template": ">=2.1,<2.1.2", - "thelia/thelia": ">=2.1,<2.1.2|>=2.1.0-beta1,<2.1.3", + "thelia/thelia": ">=2.1.0-beta1,<2.1.3|>=2.1,<2.1.2", "twig/twig": "<1.20", "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.22|>=8,<8.7.5", "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", @@ -524,7 +524,7 @@ } ], "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", - "time": "2018-01-18T10:00:53+00:00" + "time": "2018-01-22T14:51:56+00:00" }, { "name": "webimpress/composer-extra-dependency", @@ -2890,64 +2890,37 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.9.1", + "version": "3.2.2", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" + "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1" }, "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/d7c00c3000ac0ce79c96fcbfef86b49a71158cd1", + "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1", "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" }, "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" @@ -2964,7 +2937,7 @@ "phpcs", "standards" ], - "time": "2017-05-22T02:43:20+00:00" + "time": "2017-12-19T21:44:46+00:00" }, { "name": "symfony/console",