Changeset View
Changeset View
Standalone View
Standalone View
build/arclint/dummies/cppcheck.php
Show All 20 Lines | |||||
/** | /** | ||||
* This file replaces cppcheck if the former is not found, to avoid failure in 'arc lint'. | * This file replaces cppcheck if the former is not found, to avoid failure in 'arc lint'. | ||||
* It is written in PHP as we can assume php is installed if arcanist is to work at all. | * It is written in PHP as we can assume php is installed if arcanist is to work at all. | ||||
* It mimics `cppcheck --xml`. | * It mimics `cppcheck --xml`. | ||||
* Set the VERBOSE env variable to generate an 'advice' level lint message. | * Set the VERBOSE env variable to generate an 'advice' level lint message. | ||||
*/ | */ | ||||
$verbose = getenv("VERBOSE") ? getenv("VERBOSE") : false; | $verbose = (bool)getenv("VERBOSE"); | ||||
$advice = !$verbose ? "" : <<<EOD | $advice = !$verbose ? "" : <<<EOD | ||||
<error id="skipped" msg="Cppcheck was not found - skipped" severity="advice" inconclusive="true"> | <error id="skipped" msg="Cppcheck was not found - skipped" severity="advice" inconclusive="true"> | ||||
<location file="build/arclint/dummies/cppcheck.php" line="23"/> | <location file="build/arclint/dummies/cppcheck.php" line="23"/> | ||||
</error> | </error> | ||||
EOD; | EOD; | ||||
$str = <<<EOD | $str = <<<EOD | ||||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||||
<results version="2"><errors>$advice</errors></results> | <results version="2"><errors>$advice</errors></results> | ||||
EOD; | EOD; | ||||
fwrite(STDERR, $str); | fwrite(STDERR, $str); | ||||
?> |
Wildfire Games · Phabricator