mirror of
https://we.phorge.it/source/arcanist.git
synced 2025-02-16 16:58:38 +01:00
Fix an issue with PHPCS output formatting
Summary: See <https://github.com/facebook/arcanist/issues/102>. PHPCS changed its output format sometime between 1.4.6 (stable) and 1.5.0RC3. Add a "no errors" test and make the linter work on both versions. Test Plan: Ran `arc unit` on PHPCS 1.5.0RC3. Reviewers: btrahan Reviewed By: btrahan CC: aran Differential Revision: https://secure.phabricator.com/D6926
This commit is contained in:
parent
5fd07856c0
commit
699f3b3c05
2 changed files with 33 additions and 0 deletions
|
@ -62,6 +62,13 @@ final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
|
|||
}
|
||||
|
||||
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
|
||||
// NOTE: Some version of PHPCS after 1.4.6 stopped printing a valid, empty
|
||||
// XML document to stdout in the case of no errors. If PHPCS exits with
|
||||
// error 0, just ignore output.
|
||||
if (!$err) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$report_dom = new DOMDocument();
|
||||
$ok = @$report_dom->loadXML($stdout);
|
||||
if (!$ok) {
|
||||
|
|
26
src/lint/linter/__tests__/phpcs/no-errors.lint-test
Normal file
26
src/lint/linter/__tests__/phpcs/no-errors.lint-test
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* This tests for a PHPCS lint run against a file without any errors. PHPCS
|
||||
* literally requires all of this with this exact spacing and formatting.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Function
|
||||
* @package None
|
||||
* @author Abraham Lincoln <alincoln@logcab.in>
|
||||
* @license Imaginary License http://www.example.com/LICENSE
|
||||
* @version GIT: HEAD
|
||||
* @link http://www.derp.com/
|
||||
*/
|
||||
|
||||
/**
|
||||
* A function.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function f()
|
||||
{
|
||||
|
||||
}
|
||||
~~~~~~~~~~
|
Loading…
Add table
Reference in a new issue