Changeset View
Changeset View
Standalone View
Standalone View
src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | foreach ($config['linters'] as $name => $spec) { | ||||
$linter->setPaths($paths); | $linter->setPaths($paths); | ||||
$built_linters[] = $linter; | $built_linters[] = $linter; | ||||
} | } | ||||
return $built_linters; | return $built_linters; | ||||
} | } | ||||
private function loadAvailableLinters() { | private function loadAvailableLinters() { | ||||
$linters = id(new PhutilSymbolLoader()) | return id(new PhutilClassMapQuery()) | ||||
->setAncestorClass('ArcanistLinter') | ->setAncestorClass('ArcanistLinter') | ||||
->loadObjects(); | ->setUniqueMethod('getLinterConfigurationName', true) | ||||
->execute(); | |||||
$map = array(); | |||||
foreach ($linters as $linter) { | |||||
$name = $linter->getLinterConfigurationName(); | |||||
// This linter isn't selectable through configuration. | |||||
if ($name === null) { | |||||
continue; | |||||
} | |||||
if (empty($map[$name])) { | |||||
$map[$name] = $linter; | |||||
continue; | |||||
} | |||||
$orig_class = get_class($map[$name]); | |||||
$this_class = get_class($linter); | |||||
throw new Exception( | |||||
pht( | |||||
"Two linters (`%s`, `%s`) both have the same configuration ". | |||||
"name ('%s'). Linters must have unique configuration names.", | |||||
$orig_class, | |||||
$this_class, | |||||
$name)); | |||||
} | |||||
return $map; | |||||
} | } | ||||
private function matchPaths( | private function matchPaths( | ||||
array $paths, | array $paths, | ||||
array $include, | array $include, | ||||
array $exclude, | array $exclude, | ||||
array $global_exclude) { | array $global_exclude) { | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |