提交 a03085b5 编写于 作者: I Igor Canadi

Fix linters on non-fb machines

Summary:
Our linters assume that clang-format is installed at /mnt/vol/engshare/admin/scripts/clang-format and flint is installed at /home/engshare/tools/flint. This makes them fail on non-fb machines. This change will:
* if clang-format is not on a specified path, it will try running generic clang-format. Linters will still fail if clang-format is not installed, but this shouldn't be a big issue, since it's pretty easy to install it.
* flint will not be run if /home/engshare/tools/flint is not present

Test Plan: Made a change on a mac machine. Ran `arc lint`. No failures observed.

Reviewers: aekmekji, yhchiang

Reviewed By: yhchiang

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D44031
上级 1ae27113
......@@ -35,9 +35,15 @@ final class FbcodeClangFormatLinter extends BaseDirectoryScopedFormatLinter {
$args .= " --lines=$key:$key";
}
$binary = self::CLANG_FORMAT_BINARY;
if (!file_exists($binary)) {
// trust the $PATH
$binary = "clang-format";
}
return new ExecFuture(
"%s %s $args",
self::CLANG_FORMAT_BINARY,
$binary,
$this->getEngine()->getFilePathOnDisk($path));
}
......
......@@ -11,6 +11,9 @@ class FbcodeCppLinter extends ArcanistLinter {
private $rawLintOutput = array();
public function willLintPaths(array $paths) {
if (!file_exists(self::FLINT)) {
return;
}
$futures = array();
foreach ($paths as $p) {
$lpath = $this->getEngine()->getFilePathOnDisk($p);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册