diff --git a/.arclint b/.arclint --- a/.arclint +++ b/.arclint @@ -5,7 +5,7 @@ }, "clang-format": { "type": "clang-format", - "version": "7.0", + "version": ">=7.0", "bin": ["clang-format-7", "clang-format"], "include": "(^src/.*\\.(h|c|cpp|mm)$)", "exclude": [ diff --git a/arcanist/linter/ClangFormatLinter.php b/arcanist/linter/ClangFormatLinter.php --- a/arcanist/linter/ClangFormatLinter.php +++ b/arcanist/linter/ClangFormatLinter.php @@ -40,10 +40,25 @@ $matches = array(); $regex = '/^clang-format version (?P\d+\.\d+)\./'; if (preg_match($regex, $stdout, $matches)) { - return $matches['version']; + $version = $matches['version']; } else { return false; } + + /* + * FIXME: This is a hack to only allow for clang-format version 7.x. + * The .arclint `version` field only allow to filter versions using `=`, + * `>`, `<`, `>=` or `<=`. There is no facility to define that the required + * version should be >= 7.0 and < 8.0. + */ + if ($version[0] != '7') { + throw new Exception(pht('Linter %s requires clang-format version 7.x. '. + 'You have version %s.', + ClangFormatLinter::class, + $version)); + } + + return $version; } public function getInstallInstructions() { diff --git a/arcanist/phpcs.xml b/arcanist/phpcs.xml --- a/arcanist/phpcs.xml +++ b/arcanist/phpcs.xml @@ -17,6 +17,8 @@ + +