1
0
Fork 0
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:
epriestley 2011-12-21 08:51:34 -08:00
parent 89cb92a22c
commit ca879150c8
3 changed files with 12 additions and 1 deletions

View file

@ -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);

View file

@ -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);

View file

@ -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');