@ -19,32 +19,8 @@ final class ArcanistCpplintLinter extends ArcanistLinter {
return 'cpplint.py';
return 'cpplint.py';
}
}
public function getLintOptions() {
$config = $this->getEngine()->getConfigurationManager();
$options = $config->getConfigFromAnySource('lint.cpplint.options', '');
return $options;
}
public function getLintPath() {
public function getLintPath() {
$config = $this->getEngine()->getConfigurationManager();
$bin = 'cpplint.py';
$prefix = $config->getConfigFromAnySource('lint.cpplint.prefix');
$bin = $config->getConfigFromAnySource('lint.cpplint.bin', 'cpplint.py');
if ($prefix !== null) {
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
throw new ArcanistUsageException(
"Unable to find cpplint.py binary in a specified directory. Make ".
"sure that 'lint.cpplint.prefix' and 'lint.cpplint.bin' keys are ".
"set correctly. If you'd rather use a copy of cpplint installed ".
"globally, you can just remove these keys from your .arcconfig.");
}
$bin = csprintf("%s/%s", $prefix, $bin);
return $bin;
}
// Search under current dir
// Search under current dir
list($err) = exec_manual('which %s/%s', $this->linterDir(), $bin);
list($err) = exec_manual('which %s/%s', $this->linterDir(), $bin);
if (!$err) {
if (!$err) {
@ -57,7 +33,7 @@ final class ArcanistCpplintLinter extends ArcanistLinter {
throw new ArcanistUsageException(
throw new ArcanistUsageException(
"cpplint.py does not appear to be installed on this system. Install ".
"cpplint.py does not appear to be installed on this system. Install ".
"it (e.g., with 'wget \"http://google-styleguide.googlecode.com/".
"it (e.g., with 'wget \"http://google-styleguide.googlecode.com/".
"svn/trunk/cpplint/cpplint.py\"') or configure 'lint.cpplint.prefix' ".
"svn/trunk/cpplint/cpplint.py\"') ".
"in your .arcconfig to point to the directory where it resides. ".
"in your .arcconfig to point to the directory where it resides. ".
"Also don't forget to chmod a+x cpplint.py!");
"Also don't forget to chmod a+x cpplint.py!");
}
}
@ -67,10 +43,9 @@ final class ArcanistCpplintLinter extends ArcanistLinter {
public function lintPath($path) {
public function lintPath($path) {
$bin = $this->getLintPath();
$bin = $this->getLintPath();
$options = $this->getLintOptions();
$path = $this->rocksdbDir().'/'.$path;
$path = $this->rocksdbDir().'/'.$path;
$f = new ExecFuture("%C %C $path", $bin, $options );
$f = new ExecFuture("%C $path", $bin);
list($err, $stdout, $stderr) = $f->resolve();
list($err, $stdout, $stderr) = $f->resolve();