Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistJSHintLinter.php
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | if (preg_match('/^W/', $code)) { | ||||
return ArcanistLintSeverity::SEVERITY_ERROR; | return ArcanistLintSeverity::SEVERITY_ERROR; | ||||
} | } | ||||
} | } | ||||
public function getDefaultBinary() { | public function getDefaultBinary() { | ||||
return 'jshint'; | return 'jshint'; | ||||
} | } | ||||
public function getVersion() { | protected function parseVersionOutput($err, $stdout, $stderr) { | ||||
// NOTE: `jshint --version` emits version information on stderr, not stdout. | // NOTE: `jshint --version` emits version information on stderr, not stdout. | ||||
list($stdout, $stderr) = execx( | |||||
'%C --version', | |||||
$this->getExecutableCommand()); | |||||
$matches = array(); | $matches = array(); | ||||
$regex = '/^jshint v(?P<version>\d+\.\d+\.\d+)$/'; | $regex = '/^jshint v(?P<version>\d+\.\d+\.\d+)$/'; | ||||
if (preg_match($regex, $stderr, $matches)) { | if (preg_match($regex, $stderr, $matches)) { | ||||
return $matches['version']; | return $matches['version']; | ||||
} else { | } else { | ||||
return false; | return false; | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 93 Lines • Show Last 20 Lines |