Page MenuHomePhabricator

D14563.id35225.diff
No OneTemporary

D14563.id35225.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -377,6 +377,7 @@
'ArcanistXHPASTLinter' => 'lint/linter/ArcanistXHPASTLinter.php',
'ArcanistXHPASTLinterRule' => 'lint/linter/xhpast/ArcanistXHPASTLinterRule.php',
'ArcanistXHPASTLinterRuleTestCase' => 'lint/linter/xhpast/rules/__tests__/ArcanistXHPASTLinterRuleTestCase.php',
+ 'ArcanistXHPASTLinterRulesWorkflow' => 'workflow/ArcanistXHPASTLinterRulesWorkflow.php',
'ArcanistXHPASTLinterTestCase' => 'lint/linter/__tests__/ArcanistXHPASTLinterTestCase.php',
'ArcanistXMLLinter' => 'lint/linter/ArcanistXMLLinter.php',
'ArcanistXMLLinterTestCase' => 'lint/linter/__tests__/ArcanistXMLLinterTestCase.php',
@@ -765,6 +766,7 @@
'ArcanistXHPASTLinter' => 'ArcanistBaseXHPASTLinter',
'ArcanistXHPASTLinterRule' => 'Phobject',
'ArcanistXHPASTLinterRuleTestCase' => 'ArcanistLinterTestCase',
+ 'ArcanistXHPASTLinterRulesWorkflow' => 'ArcanistWorkflow',
'ArcanistXHPASTLinterTestCase' => 'ArcanistLinterTestCase',
'ArcanistXMLLinter' => 'ArcanistLinter',
'ArcanistXMLLinterTestCase' => 'ArcanistLinterTestCase',
diff --git a/src/workflow/ArcanistXHPASTLinterRulesWorkflow.php b/src/workflow/ArcanistXHPASTLinterRulesWorkflow.php
new file mode 100644
--- /dev/null
+++ b/src/workflow/ArcanistXHPASTLinterRulesWorkflow.php
@@ -0,0 +1,52 @@
+<?php
+
+/**
+ * List available XHPAST linter rules.
+ */
+final class ArcanistXHPASTLinterRulesWorkflow extends ArcanistWorkflow {
+
+ public function getWorkflowName() {
+ return 'xhpast-linter-rules';
+ }
+
+ public function getCommandSynopses() {
+ return phutil_console_format(<<<EOTEXT
+ **xhpast-linter-rules** [__options__] [__name__]
+EOTEXT
+ );
+ }
+
+ public function getCommandHelp() {
+ return phutil_console_format(pht(<<<EOTEXT
+ Supports: cli
+ List the available XHPAST linter rules.
+EOTEXT
+ ));
+ }
+
+ public function getArguments() {
+ return array();
+ }
+
+ public function run() {
+ $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 = ArcanistXHPASTLinterRule::loadAllRules();
+ ksort($rules);
+
+ foreach ($rules as $id => $rule) {
+ $table->addRow(array(
+ 'id' => $id,
+ 'class' => get_class($rule),
+ 'name' => $rule->getLintName(),
+ ));
+ }
+
+ $table->draw();
+ }
+
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 8:47 PM (3 d, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6717777
Default Alt Text
D14563.id35225.diff (2 KB)

Event Timeline