Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13995032
D9067.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
6 KB
Referenced Files
None
Subscribers
None
D9067.id.diff
View Options
diff --git a/src/lint/engine/ComprehensiveLintEngine.php b/src/lint/engine/ComprehensiveLintEngine.php
--- a/src/lint/engine/ComprehensiveLintEngine.php
+++ b/src/lint/engine/ComprehensiveLintEngine.php
@@ -33,7 +33,7 @@
$py_paths = preg_grep('/\.py$/', $paths);
$linters[] = id(new ArcanistPyFlakesLinter())->setPaths($py_paths);
$linters[] = id(new ArcanistPEP8Linter())
- ->setConfig(array('flags' => array($this->getPEP8WithTextOptions())))
+ ->setFlags(array($this->getPEP8WithTextOptions()))
->setPaths($py_paths);
$linters[] = id(new ArcanistRubyLinter())
diff --git a/src/lint/linter/ArcanistLesscLinter.php b/src/lint/linter/ArcanistLesscLinter.php
--- a/src/lint/linter/ArcanistLesscLinter.php
+++ b/src/lint/linter/ArcanistLesscLinter.php
@@ -16,6 +16,9 @@
const LINT_PARSE_ERROR = 6;
const LINT_SYNTAX_ERROR = 7;
+ private $strictMath = false;
+ private $strictUnits = false;
+
public function getInfoName() {
return pht('Less');
}
@@ -54,6 +57,19 @@
);
}
+ public function setLinterConfigurationValue($key, $value) {
+ switch ($key) {
+ case 'lessc.strict-math':
+ $this->strictMath = $value;
+ return;
+ case 'lessc.strict-units':
+ $this->strictUnits = $value;
+ return;
+ }
+
+ return parent::setLinterConfigurationValue($key, $value);
+ }
+
public function getLintNameMap() {
return array(
self::LINT_RUNTIME_ERROR => pht('Runtime Error'),
@@ -104,10 +120,8 @@
return array(
'--lint',
'--no-color',
- '--strict-math='.
- ($this->getConfig('lessc.strict-math') ? 'on' : 'off'),
- '--strict-units='.
- ($this->getConfig('lessc.strict-units') ? 'on' : 'off'));
+ '--strict-math='.($this->strictMath ? 'on' : 'off'),
+ '--strict-units='.($this->strictUnits ? 'on' : 'off'));
}
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
diff --git a/src/lint/linter/ArcanistLinter.php b/src/lint/linter/ArcanistLinter.php
--- a/src/lint/linter/ArcanistLinter.php
+++ b/src/lint/linter/ArcanistLinter.php
@@ -24,7 +24,6 @@
private $customSeverityMap = array();
private $customSeverityRules = array();
- private $config = array();
/* -( Human Readable Information )---------------------------------------- */
@@ -89,15 +88,6 @@
return $this;
}
- public function setConfig(array $config) {
- $this->config = $config;
- return $this;
- }
-
- protected function getConfig($key, $default = null) {
- return idx($this->config, $key, $default);
- }
-
public function getActivePath() {
return $this->activePath;
}
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
@@ -44,6 +44,9 @@
const LINT_REUSED_ITERATOR_REFERENCE = 39;
const LINT_KEYWORD_CASING = 40;
+ private $naminghook;
+ private $switchhook;
+
public function getLintNameMap() {
return array(
self::LINT_PHP_SYNTAX_ERROR => 'PHP Syntax Error!',
@@ -129,6 +132,32 @@
);
}
+ public function getLinterConfigurationOptions() {
+ return parent::getLinterConfigurationOptions() + array(
+ 'xhpast.naminghook' => array(
+ 'type' => 'optional ArcanistXHPASTLintNamingHook',
+ 'help' => pht(''),
+ ),
+ 'xhpast.switchhook' => array(
+ 'type' => 'optional ArcanistXHPASTLintSwitchHook',
+ 'help' => pht(''),
+ ),
+ );
+ }
+
+ public function setLinterConfigurationValue($key, $value) {
+ switch ($key) {
+ case 'xhpast.naminghook':
+ $this->naminghook = $value;
+ return;
+ case 'xhpast.switchhook':
+ $this->switchhook = $value;
+ return;
+ }
+
+ return parent::setLinterConfigurationValue($key, $value);
+ }
+
public function getCacheVersion() {
$version = '4';
$path = xhpast_get_binary_path();
@@ -464,8 +493,9 @@
$hook_obj = null;
$working_copy = $this->getEngine()->getWorkingCopy();
if ($working_copy) {
- $hook_class = $working_copy->getProjectConfig('lint.xhpast.switchhook');
- $hook_class = $this->getConfig('switchhook', $hook_class);
+ $hook_class = $this->switchhook
+ ? $this->switchhook
+ : $this->getDeprecatedConfiguration('lint.xhpast.switchhook');
if ($hook_class) {
$hook_obj = newv($hook_class, array());
assert_instances_of(array($hook_obj), 'ArcanistXHPASTLintSwitchHook');
@@ -1673,7 +1703,9 @@
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->getProjectConfig('lint.xhpast.naminghook');
+ $hook_class = $this->naminghook
+ ? $this->naminghook
+ : $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
@@ -96,7 +96,10 @@
$path_name = idx($config, 'path', $path);
$linter->addPath($path_name);
$linter->addData($path_name, $data);
- $linter->setConfig(idx($config, 'config', array()));
+ $config = idx($config, 'config', array());
+ foreach ($config as $key => $value) {
+ $linter->setLinterConfigurationValue($key, $value);
+ }
$engine->addLinter($linter);
$engine->addFileData($path_name, $data);
diff --git a/src/lint/linter/__tests__/xhpast/switches.lint-test b/src/lint/linter/__tests__/xhpast/switches.lint-test
--- a/src/lint/linter/__tests__/xhpast/switches.lint-test
+++ b/src/lint/linter/__tests__/xhpast/switches.lint-test
@@ -94,4 +94,4 @@
warning:75:3
~~~~~~~~~~
~~~~~~~~~~
-{"config":{"switchhook":"ArcanistXHPASTLintTestSwitchHook"}}
+{"config":{"xhpast.switchhook":"ArcanistXHPASTLintTestSwitchHook"}}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Oct 24, 10:13 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6736891
Default Alt Text
D9067.id.diff (6 KB)
Attached To
Mode
D9067: Remove the `getConfig` and `setConfig` method.
Attached
Detach File
Event Timeline
Log In to Comment