mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-10 08:52:39 +01:00
Improve detection of invalid unit and lint engines
Summary: We fatal confusingly if you specify a valid class that isn't of the right subclass (like a linter rather than a lint engine). Improve the error message. Test Plan: - Ran "arc lint --engine PhutilSymbolLoader", "arc unit --engine PhutilSymbolLoader", got expected failures. - Ran "arc diff" normally without errors. Reviewers: btrahan, jungejason, aran Reviewed By: aran CC: aran Differential Revision: https://secure.phabricator.com/D1259
This commit is contained in:
parent
89cb92a22c
commit
ca879150c8
3 changed files with 12 additions and 1 deletions
|
@ -159,6 +159,11 @@ EOTEXT
|
|||
}
|
||||
|
||||
PhutilSymbolLoader::loadClass($engine);
|
||||
if (!is_subclass_of($engine, 'ArcanistLintEngine')) {
|
||||
throw new ArcanistUsageException(
|
||||
"Configured lint engine '{$engine}' is not a subclass of ".
|
||||
"'ArcanistLintEngine'.");
|
||||
}
|
||||
|
||||
$engine = newv($engine, array());
|
||||
$engine->setWorkingCopy($working_copy);
|
||||
|
|
|
@ -97,8 +97,13 @@ EOTEXT
|
|||
$paths = array_keys($paths);
|
||||
}
|
||||
|
||||
|
||||
PhutilSymbolLoader::loadClass($engine_class);
|
||||
if (!is_subclass_of($engine_class, 'ArcanistBaseUnitTestEngine')) {
|
||||
throw new ArcanistUsageException(
|
||||
"Configured unit test engine '{$engine_class}' is not a subclass of ".
|
||||
"'ArcanistBaseUnitTestEngine'.");
|
||||
}
|
||||
|
||||
$this->engine = newv($engine_class, array());
|
||||
$this->engine->setWorkingCopy($working_copy);
|
||||
$this->engine->setPaths($paths);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
|
||||
|
||||
phutil_require_module('arcanist', 'exception/usage');
|
||||
phutil_require_module('arcanist', 'exception/usage/noengine');
|
||||
phutil_require_module('arcanist', 'repository/api/base');
|
||||
phutil_require_module('arcanist', 'unit/result');
|
||||
|
|
Loading…
Reference in a new issue