Changeset View
Changeset View
Standalone View
Standalone View
arcanist/linter/ClangFormatLinter.php
Show All 40 Lines | public function getVersion() { | ||||
$regex = '/^clang-format version (?P<version>\d+\.\d+)\./'; | $regex = '/^clang-format version (?P<version>\d+\.\d+)\./'; | ||||
if (preg_match($regex, $stdout, $matches)) { | if (preg_match($regex, $stdout, $matches)) { | ||||
$version = $matches['version']; | $version = $matches['version']; | ||||
} else { | } else { | ||||
return false; | return false; | ||||
} | } | ||||
/* | /* | ||||
* FIXME: This is a hack to only allow for clang-format version 8.x. | * FIXME: This is a hack to only allow for clang-format version 10.x. | ||||
* The .arclint `version` field only allow to filter versions using `=`, | * The .arclint `version` field only allow to filter versions using `=`, | ||||
* `>`, `<`, `>=` or `<=`. There is no facility to define that the required | * `>`, `<`, `>=` or `<=`. There is no facility to define that the required | ||||
* version should be >= 8.0 and < 9.0. | * version should be >= 10.0 and < 11.0. | ||||
*/ | */ | ||||
if ($version[0] != '8') { | if (substr($version, 0, 2) != '10') { | ||||
throw new Exception(pht('Linter %s requires clang-format version 8.x. '. | throw new Exception(pht('Linter %s requires clang-format version 10.x. '. | ||||
'You have version %s.', | 'You have version %s.', | ||||
ClangFormatLinter::class, | ClangFormatLinter::class, | ||||
$version)); | $version)); | ||||
} | } | ||||
return $version; | return $version; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 41 Lines • Show Last 20 Lines |