* teamcity report added

This commit is contained in:
Dávid Danyi 2018-01-26 14:24:13 +01:00
parent 47b6b59130
commit 98acdd0931
3 changed files with 75 additions and 45 deletions

55
TeamCityCsReport.php Normal file
View File

@ -0,0 +1,55 @@
<?php
namespace PHP_CodeSniffer\Reports;
use PHP_CodeSniffer\Files\File;
class TeamCityCsReport implements Report {
public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) {
if ($report['errors'] === 0 && $report['warnings'] === 0) {
return false;
}
$file = str_replace(getcwd() . '/', '', $report['filename']);
echo sprintf('##teamcity[testStarted name=\'%s\']', $file) . PHP_EOL;
foreach ($report['messages'] as $line => $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;
}
}

View File

@ -25,7 +25,7 @@
"require-dev": { "require-dev": {
"filp/whoops": "^2.1.7", "filp/whoops": "^2.1.7",
"phpunit/phpunit": "^6.0.8 || ^5.7.15", "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", "zendframework/zend-expressive-tooling": "^0.4.5",
"zfcampus/zf-development-mode": "^3.1" "zfcampus/zf-development-mode": "^3.1"
}, },
@ -52,11 +52,13 @@
], ],
"clear-config-cache": "php bin/clear-config-cache.php", "clear-config-cache": "php bin/clear-config-cache.php",
"cs-check": "phpcs", "cs-check": "phpcs",
"cs-check-ci": "phpcs --no-colors --report=TeamCityCsReport.php",
"cs-fix": "phpcbf", "cs-fix": "phpcbf",
"serve": "php -S 0.0.0.0:8888 -t public index.php", "serve": "php -S 0.0.0.0:8888 -t public index.php",
"test": "phpunit --colors=always", "test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml", "test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"test-coverage-html": "phpunit --colors=always --coverage-html test/coverage", "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" "upload-coverage": "coveralls -v"
} }
} }

61
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "6fb0545051f1b3db45bd70bffd15dc3e", "content-hash": "07e2b3690d8d7d3e264618d3236c754b",
"packages": [ "packages": [
{ {
"name": "container-interop/container-interop", "name": "container-interop/container-interop",
@ -386,12 +386,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git", "url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "402a514551804df5b4b2150f217e23a15408795a" "reference": "eca509e364dcea7b7f41f9452d575684cc8e3fb4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/402a514551804df5b4b2150f217e23a15408795a", "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/eca509e364dcea7b7f41f9452d575684cc8e3fb4",
"reference": "402a514551804df5b4b2150f217e23a15408795a", "reference": "eca509e364dcea7b7f41f9452d575684cc8e3fb4",
"shasum": "" "shasum": ""
}, },
"conflict": { "conflict": {
@ -446,7 +446,7 @@
"phpxmlrpc/extras": "<0.6.1", "phpxmlrpc/extras": "<0.6.1",
"pusher/pusher-php-server": "<2.2.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", "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/cms": ">=3,<=3.0.11|>=3.1,<3.1.11",
"silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3",
"silverstripe/framework": ">=3,<3.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/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", "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7",
"thelia/backoffice-default-template": ">=2.1,<2.1.2", "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", "twig/twig": "<1.20",
"typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.22|>=8,<8.7.5", "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", "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", "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", "name": "webimpress/composer-extra-dependency",
@ -2890,64 +2890,37 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "2.9.1", "version": "3.2.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/squizlabs/PHP_CodeSniffer.git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
"reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7c00c3000ac0ce79c96fcbfef86b49a71158cd1",
"reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-simplexml": "*", "ext-simplexml": "*",
"ext-tokenizer": "*", "ext-tokenizer": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"php": ">=5.1.2" "php": ">=5.4.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0" "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0"
}, },
"bin": [ "bin": [
"scripts/phpcs", "bin/phpcs",
"scripts/phpcbf" "bin/phpcbf"
], ],
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "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/", "notification-url": "https://packagist.org/downloads/",
"license": [ "license": [
"BSD-3-Clause" "BSD-3-Clause"
@ -2964,7 +2937,7 @@
"phpcs", "phpcs",
"standards" "standards"
], ],
"time": "2017-05-22T02:43:20+00:00" "time": "2017-12-19T21:44:46+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",