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
}
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);
$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);
+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');