Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/ArcanistExternalLinter.php
Show First 20 Lines • Show All 375 Lines • ▼ Show 20 Lines | if ($version) { | ||||
return $version.'-'.json_encode($this->getCommandFlags()); | return $version.'-'.json_encode($this->getCommandFlags()); | ||||
} else { | } else { | ||||
// Either we failed to parse the version number or the `getVersion` | // Either we failed to parse the version number or the `getVersion` | ||||
// function hasn't been implemented. | // function hasn't been implemented. | ||||
return json_encode($this->getCommandFlags()); | return json_encode($this->getCommandFlags()); | ||||
} | } | ||||
} | } | ||||
/** | |||||
* Prepare the path to be added to the command string. | |||||
* | |||||
* This method is expected to return an already escaped string. | |||||
* | |||||
* @param string Path to the file being linted | |||||
* @return string The command-ready file argument | |||||
*/ | |||||
protected function getPathArgumentForLinterFuture($path) { | |||||
return csprintf('%s', $path); | |||||
} | |||||
protected function buildFutures(array $paths) { | protected function buildFutures(array $paths) { | ||||
$executable = $this->getExecutableCommand(); | $executable = $this->getExecutableCommand(); | ||||
$bin = csprintf('%C %Ls', $executable, $this->getCommandFlags()); | $bin = csprintf('%C %Ls', $executable, $this->getCommandFlags()); | ||||
$futures = array(); | $futures = array(); | ||||
foreach ($paths as $path) { | foreach ($paths as $path) { | ||||
if ($this->supportsReadDataFromStdin()) { | if ($this->supportsReadDataFromStdin()) { | ||||
$future = new ExecFuture( | $future = new ExecFuture( | ||||
'%C %C', | '%C %C', | ||||
$bin, | $bin, | ||||
$this->getReadDataFromStdinFilename()); | $this->getReadDataFromStdinFilename()); | ||||
$future->write($this->getEngine()->loadData($path)); | $future->write($this->getEngine()->loadData($path)); | ||||
} else { | } else { | ||||
// TODO: In commit hook mode, we need to do more handling here. | // TODO: In commit hook mode, we need to do more handling here. | ||||
$disk_path = $this->getEngine()->getFilePathOnDisk($path); | $disk_path = $this->getEngine()->getFilePathOnDisk($path); | ||||
$future = new ExecFuture('%C %s', $bin, $disk_path); | $path_argument = $this->getPathArgumentForLinterFuture($disk_path); | ||||
$future = new ExecFuture('%C %C', $bin, $path_argument); | |||||
} | } | ||||
$futures[$path] = $future; | $futures[$path] = $future; | ||||
} | } | ||||
return $futures; | return $futures; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |