Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14029197
D14563.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D14563.diff
View Options
diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php
--- a/src/lint/linter/ArcanistLinter.php
+++ b/src/lint/linter/ArcanistLinter.php
@@ -58,6 +58,20 @@
}
/**
+ * Return arbitrary additional information.
+ *
+ * Linters can use this method to provide arbitrary additional information to
+ * be included in the output of `arc linters`.
+ *
+ * @return map<string, string> A mapping of header to body content for the
+ * additional information sections.
+ * @task info
+ */
+ public function getAdditionalInformation() {
+ return array();
+ }
+
+ /**
* Return a human-readable linter name.
*
* These are used by `arc linters`, and can let you give a linter a more
diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php
--- a/src/lint/linter/ArcanistXHPASTLinter.php
+++ b/src/lint/linter/ArcanistXHPASTLinter.php
@@ -46,6 +46,29 @@
return pht('Use XHPAST to enforce coding conventions on PHP source files.');
}
+ public function getAdditionalInformation() {
+ $table = id(new PhutilConsoleTable())
+ ->setBorders(true)
+ ->addColumn('id', array('title' => pht('ID')))
+ ->addColumn('class', array('title' => pht('Class')))
+ ->addColumn('name', array('title' => pht('Name')));
+
+ $rules = $this->rules;
+ ksort($rules);
+
+ foreach ($rules as $id => $rule) {
+ $table->addRow(array(
+ 'id' => $id,
+ 'class' => get_class($rule),
+ 'name' => $rule->getLintName(),
+ ));
+ }
+
+ return array(
+ pht('Linter Rules') => $table->drawConsoleString(),
+ );
+ }
+
public function getLinterName() {
return 'XHP';
}
diff --git a/src/workflow/ArcanistLintersWorkflow.php b/src/workflow/ArcanistLintersWorkflow.php
--- a/src/workflow/ArcanistLintersWorkflow.php
+++ b/src/workflow/ArcanistLintersWorkflow.php
@@ -78,6 +78,7 @@
if ($exact) {
$linter_info = $this->findExactNames($linter_info, $exact);
+
if (!$linter_info) {
$console->writeOut(
"%s\n",
@@ -170,6 +171,18 @@
$print_tail = true;
}
+ $additional = $linter['additional'];
+ foreach ($additional as $title => $body) {
+ $console->writeOut(
+ "\n%s**%s**\n\n",
+ $pad,
+ $title);
+
+ // TODO: This should maybe use `tsprintf`.
+ // See some discussion in D14563.
+ echo $body;
+ }
+
if ($print_tail) {
$console->writeOut("\n");
}
@@ -250,6 +263,7 @@
'description' => $linter->getInfoDescription(),
'exception' => $exception,
'options' => $linter->getLinterConfigurationOptions(),
+ 'additional' => $linter->getAdditionalInformation(),
);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 9, 7:58 PM (3 d, 5 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6737033
Default Alt Text
D14563.diff (2 KB)
Attached To
Mode
D14563: Add a table showing all XHPAST linter rules to the output of `arc linters xhpast`
Attached
Detach File
Event Timeline
Log In to Comment