Page MenuHomePhabricator

D3806.id10650.diff
No OneTemporary

D3806.id10650.diff

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<version>\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 @@
<exclude name="Generic.Commenting.DocComment.ParamNotFirst" />
<exclude name="Generic.Commenting.DocComment.SpacingBeforeTags" />
<exclude name="Generic.Commenting.DocComment.TagValueIndent" />
+ <exclude name="Generic.Commenting.Fixme.TaskFound" />
+ <exclude name="Generic.Commenting.Todo.TaskFound" />
<exclude name="Generic.Files.EndFileNoNewline.Found" />
<exclude name="Generic.Files.LowercasedFilename" />
<exclude name="Generic.Formatting.MultipleStatementAlignment" />

File Metadata

Mime Type
text/plain
Expires
Tue, May 20, 19:36 (8 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5865798
Default Alt Text
D3806.id10650.diff (2 KB)

Event Timeline