Page MenuHomePhabricator

D11537.diff
No OneTemporary

D11537.diff

diff --git a/src/lint/linter/ArcanistGeneratedLinter.php b/src/lint/linter/ArcanistGeneratedLinter.php
--- a/src/lint/linter/ArcanistGeneratedLinter.php
+++ b/src/lint/linter/ArcanistGeneratedLinter.php
@@ -37,6 +37,17 @@
if (preg_match('/@'.'generated/', $data)) {
$this->stopAllLinters();
}
+
+ $working_copy = $this->getEngine()->getWorkingCopy();
+ $generated_paths = $working_copy->getProjectConfig(
+ 'generated-paths',
+ array());
+
+ foreach ($generated_paths as $regex) {
+ if (preg_match($regex, $this->getActivePath())) {
+ $this->stopAllLinters();
+ }
+ }
}
}
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
@@ -79,9 +79,10 @@
PhutilTypeSpec::checkMap(
$config,
array(
+ 'arcconfig' => 'optional map<string, wild>',
'config' => 'optional map<string, wild>',
- 'path' => 'optional string',
'mode' => 'optional string',
+ 'path' => 'optional string',
'stopped' => 'optional bool',
));
@@ -104,9 +105,15 @@
$dir = dirname($full_path);
$path = basename($full_path);
+ $config_file = null;
+ $arcconfig = idx($config, 'arcconfig');
+ if ($arcconfig) {
+ $config_file = json_encode($arcconfig);
+ }
+
$working_copy = ArcanistWorkingCopyIdentity::newFromRootAndConfigFile(
$dir,
- null,
+ $config_file,
pht('Unit Test'));
$configuration_manager = new ArcanistConfigurationManager();
$configuration_manager->setWorkingCopyIdentity($working_copy);
diff --git a/src/lint/linter/__tests__/generated/generated-path.lint-test b/src/lint/linter/__tests__/generated/generated-path.lint-test
new file mode 100644
--- /dev/null
+++ b/src/lint/linter/__tests__/generated/generated-path.lint-test
@@ -0,0 +1,11 @@
+~~~~~~~~~~
+~~~~~~~~~~
+~~~~~~~~~~
+{
+ "arcconfig": {
+ "generated-paths": [
+ "(^.*$)"
+ ]
+ },
+ "stopped": true
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Mar 17, 6:39 PM (3 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7391485
Default Alt Text
D11537.diff (2 KB)

Event Timeline