Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F76075
D7382.id16626.diff
All Users
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
20 KB
Referenced Files
None
Subscribers
None
D7382.id16626.diff
View Options
diff --git a/scripts/arcanist.php b/scripts/arcanist.php
--- a/scripts/arcanist.php
+++ b/scripts/arcanist.php
@@ -130,15 +130,15 @@
// Load libraries in ".arcconfig". Libraries here must load.
arcanist_load_libraries(
- $working_copy->getConfig('load'),
+ $working_copy->getProjectConfig('load'),
$must_load = true,
$lib_source = 'the "load" setting in ".arcconfig"',
$working_copy);
}
$user_config = $configuration_manager->readUserConfigurationFile();
- $config_class = $working_copy->getConfig('arcanist_configuration');
+ $config_class = $working_copy->getProjectConfig('arcanist_configuration');
if ($config_class) {
$config = new $config_class();
} else {
diff --git a/src/configuration/ArcanistConfigurationManager.php b/src/configuration/ArcanistConfigurationManager.php
--- a/src/configuration/ArcanistConfigurationManager.php
+++ b/src/configuration/ArcanistConfigurationManager.php
@@ -25,7 +25,7 @@
public function getProjectConfig($key) {
if ($this->workingCopy) {
- return $this->workingCopy->getConfig($key);
+ return $this->workingCopy->getProjectConfig($key);
}
return null;
}
diff --git a/src/lint/linter/ArcanistCSSLintLinter.php b/src/lint/linter/ArcanistCSSLintLinter.php
--- a/src/lint/linter/ArcanistCSSLintLinter.php
+++ b/src/lint/linter/ArcanistCSSLintLinter.php
@@ -28,18 +28,18 @@
}
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.
return $options;
}
public function getDefaultBinary() {
// TODO: Deprecation warning.
- $working_copy = $this->getEngine()->getWorkingCopy();
- $bin = $working_copy->getConfig('lint.csslint.bin');
+ $config = $this->getEngine()->getConfigurationManager();
+ $bin = $config->getConfigFromAnySource('lint.csslint.bin');
if ($bin) {
return $bin;
}
diff --git a/src/lint/linter/ArcanistCppcheckLinter.php b/src/lint/linter/ArcanistCppcheckLinter.php
--- a/src/lint/linter/ArcanistCppcheckLinter.php
+++ b/src/lint/linter/ArcanistCppcheckLinter.php
@@ -19,19 +19,19 @@
}
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
- $options = $working_copy->getConfig(
+ $options = $config->getConfigFromAnySource(
'lint.cppcheck.options',
'-j2 --inconclusive --enable=performance,style,portability,information');
return $options;
}
public function getLintPath() {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $prefix = $working_copy->getConfig('lint.cppcheck.prefix');
- $bin = $working_copy->getConfig('lint.cppcheck.bin', 'cppcheck');
+ $config = $this->getEngine()->getConfigurationManager();
+ $prefix = $config->getConfigFromAnySource('lint.cppcheck.prefix');
+ $bin = $config->getConfigFromAnySource('lint.cppcheck.bin', 'cppcheck');
if ($prefix !== null) {
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
diff --git a/src/lint/linter/ArcanistCpplintLinter.php b/src/lint/linter/ArcanistCpplintLinter.php
--- a/src/lint/linter/ArcanistCpplintLinter.php
+++ b/src/lint/linter/ArcanistCpplintLinter.php
@@ -18,16 +18,16 @@
}
public function getLintOptions() {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $options = $working_copy->getConfig('lint.cpplint.options', '');
+ $config = $this->getEngine()->getConfigurationManager();
+ $options = $config->getConfigFromAnySource('lint.cpplint.options', '');
return $options;
}
public function getLintPath() {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $prefix = $working_copy->getConfig('lint.cpplint.prefix');
- $bin = $working_copy->getConfig('lint.cpplint.bin', 'cpplint.py');
+ $config = $this->getEngine()->getConfigurationManager();
+ $prefix = $config->getConfigFromAnySource('lint.cpplint.prefix');
+ $bin = $config->getConfigFromAnySource('lint.cpplint.bin', 'cpplint.py');
if ($prefix !== null) {
if (!Filesystem::pathExists($prefix.'/'.$bin)) {
diff --git a/src/lint/linter/ArcanistFlake8Linter.php b/src/lint/linter/ArcanistFlake8Linter.php
--- a/src/lint/linter/ArcanistFlake8Linter.php
+++ b/src/lint/linter/ArcanistFlake8Linter.php
@@ -19,17 +19,17 @@
public function getDefaultFlags() {
// 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;
}
public function getDefaultBinary() {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $prefix = $working_copy->getConfig('lint.flake8.prefix');
- $bin = $working_copy->getConfig('lint.flake8.bin', 'flake8');
+ $config = $this->getEngine()->getConfigurationManager();
+ $prefix = $config->getConfigFromAnySource('lint.flake8.prefix');
+ $bin = $config->getConfigFromAnySource('lint.flake8.bin', 'flake8');
if ($prefix || ($bin != 'flake8')) {
return $prefix.'/'.$bin;
diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php
--- a/src/lint/linter/ArcanistJSHintLinter.php
+++ b/src/lint/linter/ArcanistJSHintLinter.php
@@ -67,10 +67,11 @@
}
public function getJSHintOptions() {
- $working_copy = $this->getEngine()->getWorkingCopy();
+ $config_manager = $this->getEngine()->getConfigurationManager();
$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) {
$config = Filesystem::resolvePath(
$config,
@@ -89,9 +90,9 @@
}
private function getJSHintPath() {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $prefix = $working_copy->getConfig('lint.jshint.prefix');
- $bin = $working_copy->getConfig('lint.jshint.bin');
+ $config_manager = $this->getEngine()->getConfigurationManager();
+ $prefix = $config_manager->getConfigFromAnySource('lint.jshint.prefix');
+ $bin = $config_manager->getConfigFromAnySource('lint.jshint.bin');
if ($bin === null) {
$bin = "jshint";
diff --git a/src/lint/linter/ArcanistLicenseLinter.php b/src/lint/linter/ArcanistLicenseLinter.php
--- a/src/lint/linter/ArcanistLicenseLinter.php
+++ b/src/lint/linter/ArcanistLicenseLinter.php
@@ -27,8 +27,8 @@
public function lintPath($path) {
$copyright_holder = $this->getConfig('copyright_holder');
if ($copyright_holder === null) {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $copyright_holder = $working_copy->getConfig('copyright_holder');
+ $config = $this->getEngine()->getConfigurationManager();
+ $copyright_holder = $config->getConfigFromAnySource('copyright_holder');
}
if (!$copyright_holder) {
diff --git a/src/lint/linter/ArcanistPEP8Linter.php b/src/lint/linter/ArcanistPEP8Linter.php
--- a/src/lint/linter/ArcanistPEP8Linter.php
+++ b/src/lint/linter/ArcanistPEP8Linter.php
@@ -23,8 +23,8 @@
public function getDefaultFlags() {
// TODO: Warn that all of this is deprecated.
- $working_copy = $this->getEngine()->getWorkingCopy();
- $options = $working_copy->getConfig('lint.pep8.options');
+ $config = $this->getEngine()->getConfigurationManager();
+ $options = $config->getConfigFromAnySource('lint.pep8.options');
if ($options === null) {
$options = $this->getConfig('options');
@@ -46,9 +46,9 @@
return 'pep8';
}
- $working_copy = $this->getEngine()->getWorkingCopy();
- $old_prefix = $working_copy->getConfig('lint.pep8.prefix');
- $old_bin = $working_copy->getConfig('lint.pep8.bin');
+ $config = $this->getEngine()->getConfigurationManager();
+ $old_prefix = $config->getConfigFromAnySource('lint.pep8.prefix');
+ $old_bin = $config->getConfigFromAnySource('lint.pep8.bin');
if ($old_prefix || $old_bin) {
// TODO: Deprecation warning.
diff --git a/src/lint/linter/ArcanistPhpcsLinter.php b/src/lint/linter/ArcanistPhpcsLinter.php
--- a/src/lint/linter/ArcanistPhpcsLinter.php
+++ b/src/lint/linter/ArcanistPhpcsLinter.php
@@ -36,20 +36,20 @@
public function getDefaultFlags() {
// 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 : '';
return $options;
}
public function getDefaultBinary() {
// TODO: Deprecation warnings.
- $working_copy = $this->getEngine()->getWorkingCopy();
- $bin = $working_copy->getConfig('lint.phpcs.bin');
+ $config = $this->getEngine()->getConfigurationManager();
+ $bin = $config->getConfigFromAnySource('lint.phpcs.bin');
if ($bin) {
return $bin;
}
diff --git a/src/lint/linter/ArcanistPyFlakesLinter.php b/src/lint/linter/ArcanistPyFlakesLinter.php
--- a/src/lint/linter/ArcanistPyFlakesLinter.php
+++ b/src/lint/linter/ArcanistPyFlakesLinter.php
@@ -29,9 +29,9 @@
}
public function lintPath($path) {
- $working_copy = $this->getEngine()->getWorkingCopy();
- $pyflakes_path = $working_copy->getConfig('lint.pyflakes.path');
- $pyflakes_prefix = $working_copy->getConfig('lint.pyflakes.prefix');
+ $config = $this->getEngine()->getConfigurationManager();
+ $pyflakes_path = $config->getConfigFromAnySource('lint.pyflakes.path');
+ $pyflakes_prefix = $config->getConfigFromAnySource('lint.pyflakes.prefix');
// Default to just finding pyflakes in the users path
$pyflakes_bin = 'pyflakes';
diff --git a/src/lint/linter/ArcanistPyLintLinter.php b/src/lint/linter/ArcanistPyLintLinter.php
--- a/src/lint/linter/ArcanistPyLintLinter.php
+++ b/src/lint/linter/ArcanistPyLintLinter.php
@@ -55,11 +55,14 @@
private function getMessageCodeSeverity($code) {
- $working_copy = $this->getEngine()->getWorkingCopy();
+ $config = $this->getEngine()->getConfigurationManager();
- $error_regexp = $working_copy->getConfig('lint.pylint.codes.error');
- $warning_regexp = $working_copy->getConfig('lint.pylint.codes.warning');
- $advice_regexp = $working_copy->getConfig('lint.pylint.codes.advice');
+ $error_regexp =
+ $config->getConfigFromAnySource('lint.pylint.codes.error');
+ $warning_regexp =
+ $config->getConfigFromAnySource('lint.pylint.codes.warning');
+ $advice_regexp =
+ $config->getConfigFromAnySource('lint.pylint.codes.advice');
if (!$error_regexp && !$warning_regexp && !$advice_regexp) {
throw new ArcanistUsageException(
@@ -98,8 +101,8 @@
$pylint_bin = "pylint";
// Use the PyLint prefix specified in the config file
- $working_copy = $this->getEngine()->getWorkingCopy();
- $prefix = $working_copy->getConfig('lint.pylint.prefix');
+ $config = $this->getEngine()->getConfigurationManager();
+ $prefix = $config->getConfigFromAnySource('lint.pylint.prefix');
if ($prefix !== null) {
$pylint_bin = $prefix."/bin/".$pylint_bin;
}
@@ -122,11 +125,11 @@
private function getPyLintPythonPath() {
// Get non-default install locations for pylint and its dependencies
// libraries.
- $working_copy = $this->getEngine()->getWorkingCopy();
+ $config = $this->getEngine()->getConfigurationManager();
$prefixes = array(
- $working_copy->getConfig('lint.pylint.prefix'),
- $working_copy->getConfig('lint.pylint.logilab_astng.prefix'),
- $working_copy->getConfig('lint.pylint.logilab_common.prefix'),
+ $config->getConfigFromAnySource('lint.pylint.prefix'),
+ $config->getConfigFromAnySource('lint.pylint.logilab_astng.prefix'),
+ $config->getConfigFromAnySource('lint.pylint.logilab_common.prefix'),
);
// Add the libraries to the python search path
@@ -140,7 +143,8 @@
}
}
- $config_paths = $working_copy->getConfig('lint.pylint.pythonpath');
+ $working_copy = $this->getEngine()->getWorkingCopy();
+ $config_paths = $config->getConfigFromAnySource('lint.pylint.pythonpath');
if ($config_paths !== null) {
foreach ($config_paths as $config_path) {
if ($config_path !== null) {
@@ -161,20 +165,21 @@
$options = array('-rn', '-iy');
$working_copy = $this->getEngine()->getWorkingCopy();
+ $config = $this->getEngine()->getConfigurationManager();
// Specify an --rcfile, either absolute or relative to the project root.
// Stupidly, the command line args above are overridden by rcfile, so be
// careful.
- $rcfile = $working_copy->getConfig('lint.pylint.rcfile');
+ $rcfile = $config->getConfigFromAnySource('lint.pylint.rcfile');
if ($rcfile !== null) {
$rcfile = Filesystem::resolvePath(
$rcfile,
$working_copy->getProjectRoot());
$options[] = csprintf('--rcfile=%s', $rcfile);
}
// 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) {
$options = array_merge($options, $config_options);
}
diff --git a/src/lint/linter/ArcanistRubyLinter.php b/src/lint/linter/ArcanistRubyLinter.php
--- a/src/lint/linter/ArcanistRubyLinter.php
+++ b/src/lint/linter/ArcanistRubyLinter.php
@@ -17,8 +17,8 @@
public function getDefaultBinary() {
// TODO: Deprecation warning.
- $working_copy = $this->getEngine()->getWorkingCopy();
- $prefix = $working_copy->getConfig('lint.ruby.prefix');
+ $config = $this->getEngine()->getConfigurationManager();
+ $prefix = $config->getConfigFromAnySource('lint.ruby.prefix');
if ($prefix !== null) {
$ruby_bin = $prefix.'ruby';
}
diff --git a/src/lint/linter/ArcanistScalaSBTLinter.php b/src/lint/linter/ArcanistScalaSBTLinter.php
--- a/src/lint/linter/ArcanistScalaSBTLinter.php
+++ b/src/lint/linter/ArcanistScalaSBTLinter.php
@@ -27,8 +27,8 @@
$sbt_bin = "sbt";
// Use the SBT prefix specified in the config file
- $working_copy = $this->getEngine()->getWorkingCopy();
- $prefix = $working_copy->getConfig('lint.scala_sbt.prefix');
+ $config = $this->getEngine()->getConfigurationManager();
+ $prefix = $config->getConfigFromAnySource('lint.scala_sbt.prefix');
if ($prefix !== null) {
$sbt_bin = $prefix . $sbt_bin;
}
diff --git a/src/lint/linter/ArcanistXHPASTLinter.php b/src/lint/linter/ArcanistXHPASTLinter.php
--- a/src/lint/linter/ArcanistXHPASTLinter.php
+++ b/src/lint/linter/ArcanistXHPASTLinter.php
@@ -487,7 +487,7 @@
$hook_obj = null;
$working_copy = $this->getEngine()->getWorkingCopy();
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);
if ($hook_class) {
$hook_obj = newv($hook_class, array());
@@ -1696,7 +1696,7 @@
if ($working_copy) {
// If a naming hook is configured, give it a chance to override the
// 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) {
$hook_obj = newv($hook_class, array());
foreach ($names as $k => $name_attrs) {
diff --git a/src/lint/linter/__tests__/ArcanistLinterTestCase.php b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
--- a/src/lint/linter/__tests__/ArcanistLinterTestCase.php
+++ b/src/lint/linter/__tests__/ArcanistLinterTestCase.php
@@ -71,9 +71,13 @@
$dir,
$config_file,
'Unit Test');
+ $configuration_manager = new ArcanistConfigurationManager();
+ $configuration_manager->setWorkingCopyIdentity($working_copy);
+
$engine = new UnitTestableArcanistLintEngine();
$engine->setWorkingCopy($working_copy);
+ $engine->setConfigurationManager($configuration_manager);
$engine->setPaths(array($path));
$engine->setCommitHookMode(idx($config, 'hook', false));
diff --git a/src/repository/api/ArcanistGitAPI.php b/src/repository/api/ArcanistGitAPI.php
--- a/src/repository/api/ArcanistGitAPI.php
+++ b/src/repository/api/ArcanistGitAPI.php
@@ -212,7 +212,7 @@
$default_relative = null;
$working_copy = $this->getWorkingCopyIdentity();
if ($working_copy) {
- $default_relative = $working_copy->getConfig(
+ $default_relative = $working_copy->getProjectConfig(
'git.default-relative-commit');
$this->setBaseCommitExplanation(
"it is the merge-base of '{$default_relative}' and HEAD, as ".
diff --git a/src/workflow/ArcanistGetConfigWorkflow.php b/src/workflow/ArcanistGetConfigWorkflow.php
--- a/src/workflow/ArcanistGetConfigWorkflow.php
+++ b/src/workflow/ArcanistGetConfigWorkflow.php
@@ -72,7 +72,7 @@
switch ($name) {
case ArcanistConfigurationManager::CONFIG_SOURCE_PROJECT:
// Respect older names in project config.
- $val = $this->getWorkingCopy()->getConfig($key);
+ $val = $this->getWorkingCopy()->getProjectConfig($key);
break;
default:
$val = idx($config, $key);
diff --git a/src/workflow/ArcanistSvnHookPreCommitWorkflow.php b/src/workflow/ArcanistSvnHookPreCommitWorkflow.php
--- a/src/workflow/ArcanistSvnHookPreCommitWorkflow.php
+++ b/src/workflow/ArcanistSvnHookPreCommitWorkflow.php
@@ -182,7 +182,7 @@
$transaction,
$repository);
- $lint_engine = $working_copy->getConfig('lint.engine');
+ $lint_engine = $working_copy->getProjectConfig('lint.engine');
if (!$lint_engine) {
return 0;
}
diff --git a/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php b/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php
--- a/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php
+++ b/src/workingcopyidentity/ArcanistWorkingCopyIdentity.php
@@ -135,7 +135,7 @@
}
public function getProjectID() {
- return $this->getConfig('project_id');
+ return $this->getProjectConfig('project_id');
}
public function getProjectRoot() {
@@ -154,6 +154,14 @@
}
/**
+ * 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
* permanent project configuration (i.e., ".arcconfig"), not other
* configuration sources. See @{method:getConfigFromAnySource} to read from
@@ -165,7 +173,7 @@
*
* @task config
*/
- public function getConfig($key, $default = null) {
+ public function getProjectConfig($key, $default = null) {
$settings = new ArcanistSettings();
$pval = idx($this->projectConfig, $key);
@@ -175,7 +183,7 @@
if ($pval === null) {
$legacy = $settings->getLegacyName($key);
if ($legacy) {
- $pval = $this->getConfig($legacy);
+ $pval = $this->getProjectConfig($legacy);
}
}
@@ -193,7 +201,7 @@
* reads ONLY the per-working copy configuration,
* i.e. .(git|hg|svn)/arc/config, and not other configuration
* 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.
*
* @task config
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
amazon-s3
Storage Format
Raw Data
Storage Handle
phabricator/bq/za/zg574amdb7hju2ye
Default Alt Text
D7382.id16626.diff (20 KB)
Attached To
Mode
D7382: rename getConfig -> getProjectConfig, make all linters use getConfigFromAnySource
Attached
Detach File
Event Timeline
Log In to Comment