mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-22 06:42:41 +01:00
rename getConfig -> getProjectConfig, make all linters use getConfigFromAnySource
Summary: Lingers on from D7271; Rename `ArcanistWorkingCopyIdentity.getConfig()`. Changed all linters (Except one) to use `getConfigFromAnySource()`, because it seems to make sense. Test Plan: arc unit --everything; arc lint in github.com:epriestley/arclint-examples.git (Except for phpcs, flake8, cpplint and csslint which I don't have installed). Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley CC: chad, Korvin, epriestley, aran Differential Revision: https://secure.phabricator.com/D7382
This commit is contained in:
parent
4103bc423c
commit
0d212ccf5a
20 changed files with 86 additions and 68 deletions
|
@ -130,7 +130,7 @@ try {
|
||||||
|
|
||||||
// Load libraries in ".arcconfig". Libraries here must load.
|
// Load libraries in ".arcconfig". Libraries here must load.
|
||||||
arcanist_load_libraries(
|
arcanist_load_libraries(
|
||||||
$working_copy->getConfig('load'),
|
$working_copy->getProjectConfig('load'),
|
||||||
$must_load = true,
|
$must_load = true,
|
||||||
$lib_source = 'the "load" setting in ".arcconfig"',
|
$lib_source = 'the "load" setting in ".arcconfig"',
|
||||||
$working_copy);
|
$working_copy);
|
||||||
|
@ -138,7 +138,7 @@ try {
|
||||||
|
|
||||||
$user_config = $configuration_manager->readUserConfigurationFile();
|
$user_config = $configuration_manager->readUserConfigurationFile();
|
||||||
|
|
||||||
$config_class = $working_copy->getConfig('arcanist_configuration');
|
$config_class = $working_copy->getProjectConfig('arcanist_configuration');
|
||||||
if ($config_class) {
|
if ($config_class) {
|
||||||
$config = new $config_class();
|
$config = new $config_class();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -25,7 +25,7 @@ final class ArcanistConfigurationManager {
|
||||||
|
|
||||||
public function getProjectConfig($key) {
|
public function getProjectConfig($key) {
|
||||||
if ($this->workingCopy) {
|
if ($this->workingCopy) {
|
||||||
return $this->workingCopy->getConfig($key);
|
return $this->workingCopy->getProjectConfig($key);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,9 +28,9 @@ final class ArcanistCSSLintLinter extends ArcanistExternalLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDefaultFlags() {
|
public function getDefaultFlags() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
|
|
||||||
$options = $working_copy->getConfig('lint.csslint.options');
|
$options = $config->getConfigFromAnySource('lint.csslint.options');
|
||||||
// TODO: Deprecation warning.
|
// TODO: Deprecation warning.
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
|
@ -38,8 +38,8 @@ final class ArcanistCSSLintLinter extends ArcanistExternalLinter {
|
||||||
|
|
||||||
public function getDefaultBinary() {
|
public function getDefaultBinary() {
|
||||||
// TODO: Deprecation warning.
|
// TODO: Deprecation warning.
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$bin = $working_copy->getConfig('lint.csslint.bin');
|
$bin = $config->getConfigFromAnySource('lint.csslint.bin');
|
||||||
if ($bin) {
|
if ($bin) {
|
||||||
return $bin;
|
return $bin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,9 +19,9 @@ final class ArcanistCppcheckLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLintOptions() {
|
public function getLintOptions() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
// You will for sure want some options. The below default tends to be ok
|
// You will for sure want some options. The below default tends to be ok
|
||||||
$options = $working_copy->getConfig(
|
$options = $config->getConfigFromAnySource(
|
||||||
'lint.cppcheck.options',
|
'lint.cppcheck.options',
|
||||||
'-j2 --inconclusive --enable=performance,style,portability,information');
|
'-j2 --inconclusive --enable=performance,style,portability,information');
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ final class ArcanistCppcheckLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLintPath() {
|
public function getLintPath() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$prefix = $working_copy->getConfig('lint.cppcheck.prefix');
|
$prefix = $config->getConfigFromAnySource('lint.cppcheck.prefix');
|
||||||
$bin = $working_copy->getConfig('lint.cppcheck.bin', 'cppcheck');
|
$bin = $config->getConfigFromAnySource('lint.cppcheck.bin', 'cppcheck');
|
||||||
|
|
||||||
if ($prefix !== null) {
|
if ($prefix !== null) {
|
||||||
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
|
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
|
||||||
|
|
|
@ -18,16 +18,16 @@ final class ArcanistCpplintLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLintOptions() {
|
public function getLintOptions() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$options = $working_copy->getConfig('lint.cpplint.options', '');
|
$options = $config->getConfigFromAnySource('lint.cpplint.options', '');
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLintPath() {
|
public function getLintPath() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$prefix = $working_copy->getConfig('lint.cpplint.prefix');
|
$prefix = $config->getConfigFromAnySource('lint.cpplint.prefix');
|
||||||
$bin = $working_copy->getConfig('lint.cpplint.bin', 'cpplint.py');
|
$bin = $config->getConfigFromAnySource('lint.cpplint.bin', 'cpplint.py');
|
||||||
|
|
||||||
if ($prefix !== null) {
|
if ($prefix !== null) {
|
||||||
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
|
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
|
||||||
|
|
|
@ -19,17 +19,17 @@ final class ArcanistFlake8Linter extends ArcanistExternalLinter {
|
||||||
public function getDefaultFlags() {
|
public function getDefaultFlags() {
|
||||||
// TODO: Deprecated.
|
// TODO: Deprecated.
|
||||||
|
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
|
|
||||||
$options = $working_copy->getConfig('lint.flake8.options', '');
|
$options = $config->getConfigFromAnySource('lint.flake8.options', '');
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDefaultBinary() {
|
public function getDefaultBinary() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$prefix = $working_copy->getConfig('lint.flake8.prefix');
|
$prefix = $config->getConfigFromAnySource('lint.flake8.prefix');
|
||||||
$bin = $working_copy->getConfig('lint.flake8.bin', 'flake8');
|
$bin = $config->getConfigFromAnySource('lint.flake8.bin', 'flake8');
|
||||||
|
|
||||||
if ($prefix || ($bin != 'flake8')) {
|
if ($prefix || ($bin != 'flake8')) {
|
||||||
return $prefix.'/'.$bin;
|
return $prefix.'/'.$bin;
|
||||||
|
|
|
@ -67,10 +67,11 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getJSHintOptions() {
|
public function getJSHintOptions() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config_manager = $this->getEngine()->getConfigurationManager();
|
||||||
$options = '--reporter '.dirname(realpath(__FILE__)).'/reporter.js';
|
$options = '--reporter '.dirname(realpath(__FILE__)).'/reporter.js';
|
||||||
$config = $working_copy->getConfig('lint.jshint.config');
|
$config = $config_manager->getConfigFromAnySource('lint.jshint.config');
|
||||||
|
|
||||||
|
$working_copy = $this->getEngine()->getWorkingCopy();
|
||||||
if ($config !== null) {
|
if ($config !== null) {
|
||||||
$config = Filesystem::resolvePath(
|
$config = Filesystem::resolvePath(
|
||||||
$config,
|
$config,
|
||||||
|
@ -89,9 +90,9 @@ final class ArcanistJSHintLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getJSHintPath() {
|
private function getJSHintPath() {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config_manager = $this->getEngine()->getConfigurationManager();
|
||||||
$prefix = $working_copy->getConfig('lint.jshint.prefix');
|
$prefix = $config_manager->getConfigFromAnySource('lint.jshint.prefix');
|
||||||
$bin = $working_copy->getConfig('lint.jshint.bin');
|
$bin = $config_manager->getConfigFromAnySource('lint.jshint.bin');
|
||||||
|
|
||||||
if ($bin === null) {
|
if ($bin === null) {
|
||||||
$bin = "jshint";
|
$bin = "jshint";
|
||||||
|
|
|
@ -27,8 +27,8 @@ abstract class ArcanistLicenseLinter extends ArcanistLinter {
|
||||||
public function lintPath($path) {
|
public function lintPath($path) {
|
||||||
$copyright_holder = $this->getConfig('copyright_holder');
|
$copyright_holder = $this->getConfig('copyright_holder');
|
||||||
if ($copyright_holder === null) {
|
if ($copyright_holder === null) {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$copyright_holder = $working_copy->getConfig('copyright_holder');
|
$copyright_holder = $config->getConfigFromAnySource('copyright_holder');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$copyright_holder) {
|
if (!$copyright_holder) {
|
||||||
|
|
|
@ -23,8 +23,8 @@ final class ArcanistPEP8Linter extends ArcanistExternalLinter {
|
||||||
public function getDefaultFlags() {
|
public function getDefaultFlags() {
|
||||||
// TODO: Warn that all of this is deprecated.
|
// TODO: Warn that all of this is deprecated.
|
||||||
|
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$options = $working_copy->getConfig('lint.pep8.options');
|
$options = $config->getConfigFromAnySource('lint.pep8.options');
|
||||||
|
|
||||||
if ($options === null) {
|
if ($options === null) {
|
||||||
$options = $this->getConfig('options');
|
$options = $this->getConfig('options');
|
||||||
|
@ -46,9 +46,9 @@ final class ArcanistPEP8Linter extends ArcanistExternalLinter {
|
||||||
return 'pep8';
|
return 'pep8';
|
||||||
}
|
}
|
||||||
|
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$old_prefix = $working_copy->getConfig('lint.pep8.prefix');
|
$old_prefix = $config->getConfigFromAnySource('lint.pep8.prefix');
|
||||||
$old_bin = $working_copy->getConfig('lint.pep8.bin');
|
$old_bin = $config->getConfigFromAnySource('lint.pep8.bin');
|
||||||
|
|
||||||
if ($old_prefix || $old_bin) {
|
if ($old_prefix || $old_bin) {
|
||||||
// TODO: Deprecation warning.
|
// TODO: Deprecation warning.
|
||||||
|
|
|
@ -36,11 +36,11 @@ final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
|
||||||
public function getDefaultFlags() {
|
public function getDefaultFlags() {
|
||||||
// TODO: Deprecation warnings.
|
// TODO: Deprecation warnings.
|
||||||
|
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
|
|
||||||
$options = $working_copy->getConfig('lint.phpcs.options');
|
$options = $config->getConfigFromAnySource('lint.phpcs.options');
|
||||||
|
|
||||||
$standard = $working_copy->getConfig('lint.phpcs.standard');
|
$standard = $config->getConfigFromAnySource('lint.phpcs.standard');
|
||||||
$options .= !empty($standard) ? ' --standard=' . $standard : '';
|
$options .= !empty($standard) ? ' --standard=' . $standard : '';
|
||||||
|
|
||||||
return $options;
|
return $options;
|
||||||
|
@ -48,8 +48,8 @@ final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
|
||||||
|
|
||||||
public function getDefaultBinary() {
|
public function getDefaultBinary() {
|
||||||
// TODO: Deprecation warnings.
|
// TODO: Deprecation warnings.
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$bin = $working_copy->getConfig('lint.phpcs.bin');
|
$bin = $config->getConfigFromAnySource('lint.phpcs.bin');
|
||||||
if ($bin) {
|
if ($bin) {
|
||||||
return $bin;
|
return $bin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,9 +29,9 @@ final class ArcanistPyFlakesLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function lintPath($path) {
|
public function lintPath($path) {
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$pyflakes_path = $working_copy->getConfig('lint.pyflakes.path');
|
$pyflakes_path = $config->getConfigFromAnySource('lint.pyflakes.path');
|
||||||
$pyflakes_prefix = $working_copy->getConfig('lint.pyflakes.prefix');
|
$pyflakes_prefix = $config->getConfigFromAnySource('lint.pyflakes.prefix');
|
||||||
|
|
||||||
// Default to just finding pyflakes in the users path
|
// Default to just finding pyflakes in the users path
|
||||||
$pyflakes_bin = 'pyflakes';
|
$pyflakes_bin = 'pyflakes';
|
||||||
|
|
|
@ -55,11 +55,14 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
|
||||||
|
|
||||||
private function getMessageCodeSeverity($code) {
|
private function getMessageCodeSeverity($code) {
|
||||||
|
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
|
|
||||||
$error_regexp = $working_copy->getConfig('lint.pylint.codes.error');
|
$error_regexp =
|
||||||
$warning_regexp = $working_copy->getConfig('lint.pylint.codes.warning');
|
$config->getConfigFromAnySource('lint.pylint.codes.error');
|
||||||
$advice_regexp = $working_copy->getConfig('lint.pylint.codes.advice');
|
$warning_regexp =
|
||||||
|
$config->getConfigFromAnySource('lint.pylint.codes.warning');
|
||||||
|
$advice_regexp =
|
||||||
|
$config->getConfigFromAnySource('lint.pylint.codes.advice');
|
||||||
|
|
||||||
if (!$error_regexp && !$warning_regexp && !$advice_regexp) {
|
if (!$error_regexp && !$warning_regexp && !$advice_regexp) {
|
||||||
throw new ArcanistUsageException(
|
throw new ArcanistUsageException(
|
||||||
|
@ -98,8 +101,8 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
|
||||||
$pylint_bin = "pylint";
|
$pylint_bin = "pylint";
|
||||||
|
|
||||||
// Use the PyLint prefix specified in the config file
|
// Use the PyLint prefix specified in the config file
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$prefix = $working_copy->getConfig('lint.pylint.prefix');
|
$prefix = $config->getConfigFromAnySource('lint.pylint.prefix');
|
||||||
if ($prefix !== null) {
|
if ($prefix !== null) {
|
||||||
$pylint_bin = $prefix."/bin/".$pylint_bin;
|
$pylint_bin = $prefix."/bin/".$pylint_bin;
|
||||||
}
|
}
|
||||||
|
@ -122,11 +125,11 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
|
||||||
private function getPyLintPythonPath() {
|
private function getPyLintPythonPath() {
|
||||||
// Get non-default install locations for pylint and its dependencies
|
// Get non-default install locations for pylint and its dependencies
|
||||||
// libraries.
|
// libraries.
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$prefixes = array(
|
$prefixes = array(
|
||||||
$working_copy->getConfig('lint.pylint.prefix'),
|
$config->getConfigFromAnySource('lint.pylint.prefix'),
|
||||||
$working_copy->getConfig('lint.pylint.logilab_astng.prefix'),
|
$config->getConfigFromAnySource('lint.pylint.logilab_astng.prefix'),
|
||||||
$working_copy->getConfig('lint.pylint.logilab_common.prefix'),
|
$config->getConfigFromAnySource('lint.pylint.logilab_common.prefix'),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add the libraries to the python search path
|
// Add the libraries to the python search path
|
||||||
|
@ -140,7 +143,8 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$config_paths = $working_copy->getConfig('lint.pylint.pythonpath');
|
$working_copy = $this->getEngine()->getWorkingCopy();
|
||||||
|
$config_paths = $config->getConfigFromAnySource('lint.pylint.pythonpath');
|
||||||
if ($config_paths !== null) {
|
if ($config_paths !== null) {
|
||||||
foreach ($config_paths as $config_path) {
|
foreach ($config_paths as $config_path) {
|
||||||
if ($config_path !== null) {
|
if ($config_path !== null) {
|
||||||
|
@ -161,11 +165,12 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
|
||||||
$options = array('-rn', '-iy');
|
$options = array('-rn', '-iy');
|
||||||
|
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$working_copy = $this->getEngine()->getWorkingCopy();
|
||||||
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
|
|
||||||
// Specify an --rcfile, either absolute or relative to the project root.
|
// Specify an --rcfile, either absolute or relative to the project root.
|
||||||
// Stupidly, the command line args above are overridden by rcfile, so be
|
// Stupidly, the command line args above are overridden by rcfile, so be
|
||||||
// careful.
|
// careful.
|
||||||
$rcfile = $working_copy->getConfig('lint.pylint.rcfile');
|
$rcfile = $config->getConfigFromAnySource('lint.pylint.rcfile');
|
||||||
if ($rcfile !== null) {
|
if ($rcfile !== null) {
|
||||||
$rcfile = Filesystem::resolvePath(
|
$rcfile = Filesystem::resolvePath(
|
||||||
$rcfile,
|
$rcfile,
|
||||||
|
@ -174,7 +179,7 @@ final class ArcanistPyLintLinter extends ArcanistLinter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add any options defined in the config file for PyLint
|
// Add any options defined in the config file for PyLint
|
||||||
$config_options = $working_copy->getConfig('lint.pylint.options');
|
$config_options = $config->getConfigFromAnySource('lint.pylint.options');
|
||||||
if ($config_options !== null) {
|
if ($config_options !== null) {
|
||||||
$options = array_merge($options, $config_options);
|
$options = array_merge($options, $config_options);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ final class ArcanistRubyLinter extends ArcanistExternalLinter {
|
||||||
|
|
||||||
public function getDefaultBinary() {
|
public function getDefaultBinary() {
|
||||||
// TODO: Deprecation warning.
|
// TODO: Deprecation warning.
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$prefix = $working_copy->getConfig('lint.ruby.prefix');
|
$prefix = $config->getConfigFromAnySource('lint.ruby.prefix');
|
||||||
if ($prefix !== null) {
|
if ($prefix !== null) {
|
||||||
$ruby_bin = $prefix.'ruby';
|
$ruby_bin = $prefix.'ruby';
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@ final class ArcanistScalaSBTLinter extends ArcanistLinter {
|
||||||
$sbt_bin = "sbt";
|
$sbt_bin = "sbt";
|
||||||
|
|
||||||
// Use the SBT prefix specified in the config file
|
// Use the SBT prefix specified in the config file
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$config = $this->getEngine()->getConfigurationManager();
|
||||||
$prefix = $working_copy->getConfig('lint.scala_sbt.prefix');
|
$prefix = $config->getConfigFromAnySource('lint.scala_sbt.prefix');
|
||||||
if ($prefix !== null) {
|
if ($prefix !== null) {
|
||||||
$sbt_bin = $prefix . $sbt_bin;
|
$sbt_bin = $prefix . $sbt_bin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -487,7 +487,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
||||||
$hook_obj = null;
|
$hook_obj = null;
|
||||||
$working_copy = $this->getEngine()->getWorkingCopy();
|
$working_copy = $this->getEngine()->getWorkingCopy();
|
||||||
if ($working_copy) {
|
if ($working_copy) {
|
||||||
$hook_class = $working_copy->getConfig('lint.xhpast.switchhook');
|
$hook_class = $working_copy->getProjectConfig('lint.xhpast.switchhook');
|
||||||
$hook_class = $this->getConfig('switchhook', $hook_class);
|
$hook_class = $this->getConfig('switchhook', $hook_class);
|
||||||
if ($hook_class) {
|
if ($hook_class) {
|
||||||
$hook_obj = newv($hook_class, array());
|
$hook_obj = newv($hook_class, array());
|
||||||
|
@ -1696,7 +1696,7 @@ final class ArcanistXHPASTLinter extends ArcanistBaseXHPASTLinter {
|
||||||
if ($working_copy) {
|
if ($working_copy) {
|
||||||
// If a naming hook is configured, give it a chance to override the
|
// If a naming hook is configured, give it a chance to override the
|
||||||
// default results for all the symbol names.
|
// default results for all the symbol names.
|
||||||
$hook_class = $working_copy->getConfig('lint.xhpast.naminghook');
|
$hook_class = $working_copy->getProjectConfig('lint.xhpast.naminghook');
|
||||||
if ($hook_class) {
|
if ($hook_class) {
|
||||||
$hook_obj = newv($hook_class, array());
|
$hook_obj = newv($hook_class, array());
|
||||||
foreach ($names as $k => $name_attrs) {
|
foreach ($names as $k => $name_attrs) {
|
||||||
|
|
|
@ -71,9 +71,13 @@ abstract class ArcanistLinterTestCase extends ArcanistPhutilTestCase {
|
||||||
$dir,
|
$dir,
|
||||||
$config_file,
|
$config_file,
|
||||||
'Unit Test');
|
'Unit Test');
|
||||||
|
$configuration_manager = new ArcanistConfigurationManager();
|
||||||
|
$configuration_manager->setWorkingCopyIdentity($working_copy);
|
||||||
|
|
||||||
|
|
||||||
$engine = new UnitTestableArcanistLintEngine();
|
$engine = new UnitTestableArcanistLintEngine();
|
||||||
$engine->setWorkingCopy($working_copy);
|
$engine->setWorkingCopy($working_copy);
|
||||||
|
$engine->setConfigurationManager($configuration_manager);
|
||||||
$engine->setPaths(array($path));
|
$engine->setPaths(array($path));
|
||||||
|
|
||||||
$engine->setCommitHookMode(idx($config, 'hook', false));
|
$engine->setCommitHookMode(idx($config, 'hook', false));
|
||||||
|
|
|
@ -212,7 +212,7 @@ final class ArcanistGitAPI extends ArcanistRepositoryAPI {
|
||||||
$default_relative = null;
|
$default_relative = null;
|
||||||
$working_copy = $this->getWorkingCopyIdentity();
|
$working_copy = $this->getWorkingCopyIdentity();
|
||||||
if ($working_copy) {
|
if ($working_copy) {
|
||||||
$default_relative = $working_copy->getConfig(
|
$default_relative = $working_copy->getProjectConfig(
|
||||||
'git.default-relative-commit');
|
'git.default-relative-commit');
|
||||||
$this->setBaseCommitExplanation(
|
$this->setBaseCommitExplanation(
|
||||||
"it is the merge-base of '{$default_relative}' and HEAD, as ".
|
"it is the merge-base of '{$default_relative}' and HEAD, as ".
|
||||||
|
|
|
@ -72,7 +72,7 @@ EOTEXT
|
||||||
switch ($name) {
|
switch ($name) {
|
||||||
case ArcanistConfigurationManager::CONFIG_SOURCE_PROJECT:
|
case ArcanistConfigurationManager::CONFIG_SOURCE_PROJECT:
|
||||||
// Respect older names in project config.
|
// Respect older names in project config.
|
||||||
$val = $this->getWorkingCopy()->getConfig($key);
|
$val = $this->getWorkingCopy()->getProjectConfig($key);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$val = idx($config, $key);
|
$val = idx($config, $key);
|
||||||
|
|
|
@ -182,7 +182,7 @@ EOTEXT
|
||||||
$transaction,
|
$transaction,
|
||||||
$repository);
|
$repository);
|
||||||
|
|
||||||
$lint_engine = $working_copy->getConfig('lint.engine');
|
$lint_engine = $working_copy->getProjectConfig('lint.engine');
|
||||||
if (!$lint_engine) {
|
if (!$lint_engine) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,7 +135,7 @@ final class ArcanistWorkingCopyIdentity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProjectID() {
|
public function getProjectID() {
|
||||||
return $this->getConfig('project_id');
|
return $this->getProjectConfig('project_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getProjectRoot() {
|
public function getProjectRoot() {
|
||||||
|
@ -153,6 +153,14 @@ final class ArcanistWorkingCopyIdentity {
|
||||||
return $this->projectConfig;
|
return $this->projectConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Deprecated; use @{method:getProjectConfig}.
|
||||||
|
*/
|
||||||
|
public function getConfig($key, $default = null) {
|
||||||
|
return $this->getProjectConfig($key, $default);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read a configuration directive from project configuration. This reads ONLY
|
* Read a configuration directive from project configuration. This reads ONLY
|
||||||
* permanent project configuration (i.e., ".arcconfig"), not other
|
* permanent project configuration (i.e., ".arcconfig"), not other
|
||||||
|
@ -165,7 +173,7 @@ final class ArcanistWorkingCopyIdentity {
|
||||||
*
|
*
|
||||||
* @task config
|
* @task config
|
||||||
*/
|
*/
|
||||||
public function getConfig($key, $default = null) {
|
public function getProjectConfig($key, $default = null) {
|
||||||
$settings = new ArcanistSettings();
|
$settings = new ArcanistSettings();
|
||||||
|
|
||||||
$pval = idx($this->projectConfig, $key);
|
$pval = idx($this->projectConfig, $key);
|
||||||
|
@ -175,7 +183,7 @@ final class ArcanistWorkingCopyIdentity {
|
||||||
if ($pval === null) {
|
if ($pval === null) {
|
||||||
$legacy = $settings->getLegacyName($key);
|
$legacy = $settings->getLegacyName($key);
|
||||||
if ($legacy) {
|
if ($legacy) {
|
||||||
$pval = $this->getConfig($legacy);
|
$pval = $this->getProjectConfig($legacy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +201,7 @@ final class ArcanistWorkingCopyIdentity {
|
||||||
* reads ONLY the per-working copy configuration,
|
* reads ONLY the per-working copy configuration,
|
||||||
* i.e. .(git|hg|svn)/arc/config, and not other configuration
|
* i.e. .(git|hg|svn)/arc/config, and not other configuration
|
||||||
* sources. See @{method:getConfigFromAnySource} to read from any
|
* sources. See @{method:getConfigFromAnySource} to read from any
|
||||||
* config source or @{method:getConfig} to read permanent
|
* config source or @{method:getProjectConfig} to read permanent
|
||||||
* project-level config.
|
* project-level config.
|
||||||
*
|
*
|
||||||
* @task config
|
* @task config
|
||||||
|
|
Loading…
Reference in a new issue