Changeset View
Changeset View
Standalone View
Standalone View
build/arclint/dummies/eslint.php
Show All 20 Lines | |||||
/** | /** | ||||
* This file replaces eslint if the former is not found, to avoid failure in 'arc lint'. | * This file replaces eslint 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 `eslint --format json`. | * It mimics `eslint --format json`. | ||||
* 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 = <<<EOD | $advice = <<<EOD | ||||
{ | { | ||||
"filePath": "build/arclint/dummies/eslint.php", | "filePath": "build/arclint/dummies/eslint.php", | ||||
"messages": [{ | "messages": [{ | ||||
"ruleId": "skipped", | "ruleId": "skipped", | ||||
"severity": 0, | "severity": 0, | ||||
"message": "ESLint not found - skipped", | "message": "ESLint not found - skipped", | ||||
"line": 23, | "line": 23, | ||||
"column": 0 | "column": 0 | ||||
}] | }] | ||||
} | } | ||||
EOD; | EOD; | ||||
fwrite(STDOUT, $verbose ? "[$advice]" : "[]"); | fwrite(STDOUT, $verbose ? "[$advice]" : "[]"); | ||||
?> | |||||
wraitii: Is this standard PHP style? | |||||
Done Inline ActionsYeah, it's considered bad form to end PHP files with ?> as that means the leaves file outside the interpreter and in the HTML web response mode (or stdout text writer) and can sometimes produce unexpected buffer errors or http headers in strange contexts if e.g. accidentally having a line break after it. As it stands its effect is basically invisible and harmless here for this case specifically. It's just a good habit is all. Check e.g. any file in https://github.com/wordpress/wordpress/, https://github.com/phacility/arcanist, or https://github.com/wikimedia/mediawiki/. Krinkle: Yeah, it's considered bad form to end PHP files with `?>` as that means the leaves file outside… |
Wildfire Games · Phabricator
Is this standard PHP style?