Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15454894
D11205.id27000.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D11205.id27000.diff
View Options
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
@@ -125,6 +125,7 @@
'ArcanistMercurialParserTestCase' => 'repository/parser/__tests__/ArcanistMercurialParserTestCase.php',
'ArcanistMergeConflictLinter' => 'lint/linter/ArcanistMergeConflictLinter.php',
'ArcanistMergeConflictLinterTestCase' => 'lint/linter/__tests__/ArcanistMergeConflictLinterTestCase.php',
+ 'ArcanistMissingLinterException' => 'lint/linter/ArcanistMissingLinterException.php',
'ArcanistNoEffectException' => 'exception/usage/ArcanistNoEffectException.php',
'ArcanistNoEngineException' => 'exception/usage/ArcanistNoEngineException.php',
'ArcanistNoLintLinter' => 'lint/linter/ArcanistNoLintLinter.php',
@@ -308,6 +309,7 @@
'ArcanistMercurialParserTestCase' => 'ArcanistTestCase',
'ArcanistMergeConflictLinter' => 'ArcanistLinter',
'ArcanistMergeConflictLinterTestCase' => 'ArcanistArcanistLinterTestCase',
+ 'ArcanistMissingLinterException' => 'Exception',
'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException',
'ArcanistNoLintLinter' => 'ArcanistLinter',
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
@@ -265,7 +265,7 @@
if ($interpreter) {
if (!Filesystem::binaryExists($interpreter)) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
pht(
'Unable to locate interpreter "%s" to run linter %s. You may need '.
'to install the interpreter, or adjust your linter configuration.',
@@ -273,7 +273,7 @@
get_class($this)));
}
if (!Filesystem::pathExists($binary)) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
sprintf(
"%s\n%s",
pht(
@@ -287,7 +287,7 @@
}
} else {
if (!Filesystem::binaryExists($binary)) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
sprintf(
"%s\n%s",
pht(
diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php
--- a/src/lint/linter/ArcanistJSHintLinter.php
+++ b/src/lint/linter/ArcanistJSHintLinter.php
@@ -148,7 +148,7 @@
if (!is_array($errors)) {
// Something went wrong and we can't decode the output. Exit abnormally.
- throw new ArcanistUsageException(
+ throw new RuntimeException(
"JSHint returned unparseable output.\n".
"stdout:\n\n{$stdout}".
"stderr:\n\n{$stderr}");
diff --git a/src/lint/linter/ArcanistMissingLinterException.php b/src/lint/linter/ArcanistMissingLinterException.php
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/ArcanistMissingLinterException.php
@@ -0,0 +1,3 @@
+<?php
+
+final class ArcanistMissingLinterException extends Exception {}
diff --git a/src/lint/linter/ArcanistPyLintLinter.php b/src/lint/linter/ArcanistPyLintLinter.php
--- a/src/lint/linter/ArcanistPyLintLinter.php
+++ b/src/lint/linter/ArcanistPyLintLinter.php
@@ -108,7 +108,7 @@
list($err) = exec_manual('which %s', $pylint_bin);
if ($err) {
- throw new ArcanistUsageException(
+ throw new ArcanistMissingLinterException(
"PyLint does not appear to be installed on this system. Install it ".
"(e.g., with 'sudo easy_install pylint') or configure ".
"'lint.pylint.prefix' in your .arcconfig to point to the directory ".
diff --git a/src/lint/linter/__tests__/ArcanistExternalLinterTestCase.php b/src/lint/linter/__tests__/ArcanistExternalLinterTestCase.php
--- a/src/lint/linter/__tests__/ArcanistExternalLinterTestCase.php
+++ b/src/lint/linter/__tests__/ArcanistExternalLinterTestCase.php
@@ -8,7 +8,7 @@
$this->assertTrue(
$version !== false,
pht('Failed to parse version from command.'));
- } catch (ArcanistUsageException $ex) {
+ } catch (ArcanistMissingLinterException $ex) {
$this->assertSkipped($ex->getMessage());
}
}
diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
--- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php
+++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
@@ -145,13 +145,15 @@
if ($exception instanceof PhutilAggregateException) {
$caught_exception = false;
foreach ($exception->getExceptions() as $ex) {
- if ($ex instanceof ArcanistUsageException) {
+ if ($ex instanceof ArcanistUsageException ||
+ $ex instanceof ArcanistMissingLinterException) {
$this->assertSkipped($ex->getMessage());
} else {
$caught_exception = true;
}
}
- } else if ($exception instanceof ArcanistUsageException) {
+ } else if ($exception instanceof ArcanistUsageException ||
+ $exception instanceof ArcanistMissingLinterException) {
$this->assertSkipped($exception->getMessage());
}
$exception_message = $exception->getMessage()."\n\n".
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Mar 30, 9:07 PM (3 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7716053
Default Alt Text
D11205.id27000.diff (5 KB)
Attached To
Mode
D11205: Create a custom exception class for missing linter dependencies
Attached
Detach File
Event Timeline
Log In to Comment