Changeset View
Changeset View
Standalone View
Standalone View
src/lint/linter/__tests__/ArcanistLinterTestCase.php
Show First 20 Lines • Show All 70 Lines • ▼ Show 20 Lines | private function lintFile($file, ArcanistLinter $linter) { | ||||
if ($config) { | if ($config) { | ||||
$config = phutil_json_decode($config); | $config = phutil_json_decode($config); | ||||
} else { | } else { | ||||
$config = array(); | $config = array(); | ||||
} | } | ||||
PhutilTypeSpec::checkMap( | PhutilTypeSpec::checkMap( | ||||
$config, | $config, | ||||
array( | array( | ||||
'hook' => 'optional bool', | |||||
'config' => 'optional map<string, wild>', | 'config' => 'optional map<string, wild>', | ||||
'path' => 'optional string', | 'path' => 'optional string', | ||||
'mode' => 'optional string', | 'mode' => 'optional string', | ||||
'stopped' => 'optional bool', | 'stopped' => 'optional bool', | ||||
)); | )); | ||||
$exception = null; | $exception = null; | ||||
$after_lint = null; | $after_lint = null; | ||||
Show All 21 Lines | try { | ||||
$configuration_manager = new ArcanistConfigurationManager(); | $configuration_manager = new ArcanistConfigurationManager(); | ||||
$configuration_manager->setWorkingCopyIdentity($working_copy); | $configuration_manager->setWorkingCopyIdentity($working_copy); | ||||
$engine = new ArcanistUnitTestableLintEngine(); | $engine = new ArcanistUnitTestableLintEngine(); | ||||
$engine->setWorkingCopy($working_copy); | $engine->setWorkingCopy($working_copy); | ||||
$engine->setConfigurationManager($configuration_manager); | $engine->setConfigurationManager($configuration_manager); | ||||
$engine->setCommitHookMode(idx($config, 'hook', false)); | |||||
$path_name = idx($config, 'path', $path); | $path_name = idx($config, 'path', $path); | ||||
$engine->setPaths(array($path_name)); | $engine->setPaths(array($path_name)); | ||||
$linter->addPath($path_name); | $linter->addPath($path_name); | ||||
$linter->addData($path_name, $data); | $linter->addData($path_name, $data); | ||||
foreach (idx($config, 'config', array()) as $key => $value) { | foreach (idx($config, 'config', array()) as $key => $value) { | ||||
$linter->setLinterConfigurationValue($key, $value); | $linter->setLinterConfigurationValue($key, $value); | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |