Page MenuHomePhabricator

D9062.id21519.diff
No OneTemporary

D9062.id21519.diff

diff --git a/src/lint/linter/ArcanistExternalLinter.php b/src/lint/linter/ArcanistExternalLinter.php
--- a/src/lint/linter/ArcanistExternalLinter.php
+++ b/src/lint/linter/ArcanistExternalLinter.php
@@ -442,6 +442,23 @@
}
}
+ public function getInfoOptions() {
+ return array(
+ 'bin' => pht(
+ 'Specify a string (or list of strings) identifying the binary '.
+ 'which should be invoked to execute this linter. This overrides '.
+ 'the default binary. If you provide a list of possible binaries, '.
+ 'the first one which exists will be used.'),
+ 'flags' => pht(
+ 'Provide a list of additional flags to pass to the linter on the '.
+ 'command line.'),
+ 'interpreter' => pht(
+ 'Specify a string (or list of strings) identifying the interpreter '.
+ 'which should be used to invoke the linter binary. If you provide '.
+ 'a list of possible interpreters, the first one that exists '.
+ 'will be used.'),
+ ) + parent::getInfoOptions();
+ }
public function getLinterConfigurationOptions() {
$options = array(
diff --git a/src/lint/linter/ArcanistLesscLinter.php b/src/lint/linter/ArcanistLesscLinter.php
--- a/src/lint/linter/ArcanistLesscLinter.php
+++ b/src/lint/linter/ArcanistLesscLinter.php
@@ -30,6 +30,16 @@
'source files.');
}
+ public function getInfoOptions() {
+ return array(
+ 'lessc.strict-math' => pht(
+ 'Enable strict math, which only processes mathematical expressions '.
+ 'inside extraneous parentheses.'),
+ 'lessc.strict-units' => pht(
+ 'Enable strict handling of units in expressions.'),
+ ) + parent::getInfoOptions();
+ }
+
public function getLinterName() {
return 'LESSC';
}
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
@@ -74,6 +74,27 @@
get_class($this));
}
+
+ /**
+ * Return a human-readable description of linter configuration options.
+ *
+ * These are used by `arc linters` to explain options to users.
+ *
+ * @return map<string, string> Map of options to help text.
+ * @task info
+ */
+ public function getInfoOptions() {
+ return array(
+ 'severity' => pht(
+ 'Provide a map from lint codes to adjusted severity levels: error, '.
+ 'warning, advice, autofix or disabled.'),
+ 'severity.rules' => pht(
+ 'Provide a map of regular expressions to severity levels. All '.
+ 'matching codes have their severity adjusted.')
+ );
+ }
+
+
public function getLinterPriority() {
return 1.0;
}
diff --git a/src/lint/linter/ArcanistTextLinter.php b/src/lint/linter/ArcanistTextLinter.php
--- a/src/lint/linter/ArcanistTextLinter.php
+++ b/src/lint/linter/ArcanistTextLinter.php
@@ -27,6 +27,14 @@
'and trailing whitespace.');
}
+ public function getInfoOptions() {
+ return array(
+ 'text.max-line-length' => pht(
+ 'Adjust the maximum line length before a warning is raised. By '.
+ 'default, a warning is raised on lines exceeding 80 characters.'),
+ ) + parent::getInfoOptions();
+ }
+
public function getLinterPriority() {
return 0.5;
}
diff --git a/src/workflow/ArcanistLintersWorkflow.php b/src/workflow/ArcanistLintersWorkflow.php
--- a/src/workflow/ArcanistLintersWorkflow.php
+++ b/src/workflow/ArcanistLintersWorkflow.php
@@ -26,7 +26,11 @@
}
public function getArguments() {
- return array();
+ return array(
+ 'verbose' => array(
+ 'help' => pht('Show detailed information, including options.'),
+ ),
+ );
}
public function run() {
@@ -77,6 +81,8 @@
'uri' => $linter->getInfoURI(),
'description' => $linter->getInfoDescription(),
'exception' => $exception,
+ 'options' => $linter->getLinterConfigurationOptions(),
+ 'help' => $linter->getInfoOptions(),
);
}
@@ -137,10 +143,46 @@
$print_tail = true;
}
+ $options = $linter['options'];
+ if ($options && $this->getArgument('verbose')) {
+ $help = $linter['help'];
+
+ $console->writeOut(
+ "\n%s**%s**\n\n",
+ $pad,
+ pht('Configuration Options'));
+
+ $last_option = last_key($options);
+ foreach ($options as $option => $type) {
+ $console->writeOut(
+ "%s__%s__ (%s)\n",
+ $pad,
+ $option,
+ $type);
+ if (idx($help, $option)) {
+ $console->writeOut(
+ "%s\n",
+ phutil_console_wrap(
+ idx($help, $option),
+ strlen($pad) + 2));
+ }
+ if ($option != $last_option) {
+ $console->writeOut("\n");
+ }
+ }
+ $print_tail = true;
+ }
+
if ($print_tail) {
$console->writeOut("\n");
}
}
+
+ if (!$this->getArgument('verbose')) {
+ $console->writeOut(
+ "%s\n",
+ pht('(Run `arc linters --verbose` for more details.)'));
+ }
}

File Metadata

Mime Type
text/plain
Expires
Fri, Mar 21, 5:18 AM (1 d, 15 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7228159
Default Alt Text
D9062.id21519.diff (5 KB)

Event Timeline