Changeset View
Changeset View
Standalone View
Standalone View
arcanist/linter/ShellCheckLinter.php
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | final class ShellCheckLinter extends ArcanistExternalLinter { | ||||
public function getInstallInstructions() { | public function getInstallInstructions() { | ||||
return pht('Make sure shellcheck is in directory specified by $PATH'); | return pht('Make sure shellcheck is in directory specified by $PATH'); | ||||
} | } | ||||
public function shouldExpectCommandErrors() { | public function shouldExpectCommandErrors() { | ||||
return true; | return true; | ||||
} | } | ||||
public function getVersion() { | |||||
list($stdout) = execx('%C --version', $this->getExecutableCommand()); | |||||
$regex = '/^version: (?P<version>\d+\.\d+\.\d+)/m'; | |||||
if (preg_match($regex, $stdout, $matches)) { | |||||
return $matches['version']; | |||||
} | |||||
return false; | |||||
} | |||||
protected function getMandatoryFlags() { | protected function getMandatoryFlags() { | ||||
return array( | return array( | ||||
'--format=gcc', | '--format=gcc', | ||||
'--exclude='.implode(',', self::SHELLCHECK_EXCLUDED_RULES)); | '--exclude='.implode(',', self::SHELLCHECK_EXCLUDED_RULES)); | ||||
} | } | ||||
private function getSeverity($severity) { | private function getSeverity($severity) { | ||||
if (array_key_exists($severity, self::SHELLCHECK_SEVERITY_MAP)) { | if (array_key_exists($severity, self::SHELLCHECK_SEVERITY_MAP)) { | ||||
Show All 29 Lines |