Fix the lint issues in dev box
Summary: Owing to the difference between platforms (my macbook and dev server), arc lint throws fatal error in dev box. To fix the problem (quickly), I removed all incompatible function calls. Test Plan: ran `arc lint` in dev box and passed. Reviewers: igor, yhchiang CC: leveldb Differential Revision: https://reviews.facebook.net/D16173
This commit is contained in:
parent
be7e273d83
commit
78ce24a709
@ -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();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user