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
main
Igor Canadi 10 years ago
parent 1ae27113c7
commit a03085b556
  1. 8
      arcanist_util/cpp_linter/FbcodeClangFormatLinter.php
  2. 3
      arcanist_util/cpp_linter/FbcodeCppLinter.php

@ -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);

Loading…
Cancel
Save