Page MenuHomePhabricator

D9021.id.diff
No OneTemporary

D9021.id.diff

diff --git a/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php b/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
--- a/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
+++ b/src/lint/engine/ArcanistConfigurationDrivenLintEngine.php
@@ -2,8 +2,6 @@
final class ArcanistConfigurationDrivenLintEngine extends ArcanistLintEngine {
- private $debugMode;
-
public function buildLinters() {
$working_copy = $this->getWorkingCopy();
$config_path = $working_copy->getProjectPath('.arclint');
@@ -28,11 +26,8 @@
$config,
array(
'linters' => 'map<string, map<string, wild>>',
- 'debug' => 'optional bool',
));
- $this->debugMode = idx($config, 'debug', false);
-
$built_linters = array();
$all_paths = $this->getPaths();
foreach ($config['linters'] as $name => $spec) {
@@ -84,10 +79,11 @@
$this->validateRegexps($include, $name, 'include');
$this->validateRegexps($exclude, $name, 'exclude');
- $this->debugLog('Examining paths for linter "%s".', $name);
+ $console = PhutilConsole::getConsole();
+ $console->writeLog("Examining paths for linter \"%s\".\n", $name);
$paths = $this->matchPaths($all_paths, $include, $exclude);
- $this->debugLog(
- 'Found %d matching paths for linter "%s".',
+ $console->writeLog(
+ "Found %d matching paths for linter \"%s\".\n",
count($paths),
$name);
@@ -131,48 +127,53 @@
}
private function matchPaths(array $paths, array $include, array $exclude) {
- $debug = $this->debugMode;
+ $console = PhutilConsole::getConsole();
$match = array();
foreach ($paths as $path) {
- $this->debugLog("Examining path '%s'...", $path);
+ $console->writeLog("Examining path '%s'...\n", $path);
$keep = false;
if (!$include) {
$keep = true;
- $this->debugLog(
- " Including path by default because there is no 'include' rule.");
+ $console->writeLog(
+ " Including path by default because there is no 'include' rule.\n");
} else {
- $this->debugLog(' Testing "include" rules.');
+ $console->writeLog(" Testing \"include\" rules.\n");
foreach ($include as $rule) {
if (preg_match($rule, $path)) {
$keep = true;
- $this->debugLog(' Path matches include rule: %s', $rule);
+ $console->writeLog(" Path matches include rule: %s\n", $rule);
break;
} else {
- $this->debugLog(' Path does not match include rule: %s', $rule);
+ $console->writeLog(
+ " Path does not match include rule: %s\n",
+ $rule);
}
}
}
if (!$keep) {
- $this->debugLog(' Path does not match any include rules, discarding.');
+ $console->writeLogLog(
+ " Path does not match any include rules, discarding.\n");
continue;
}
if ($exclude) {
- $this->debugLog(' Testing "exclude" rules.');
+ $console->writeLog(" Testing \"exclude\" rules.\n");
foreach ($exclude as $rule) {
if (preg_match($rule, $path)) {
- $this->debugLog(' Path matches "exclude" rule: %s', $rule);
+ $console->writeLog(" Path matches \"exclude\" rule: %s\n", $rule);
continue 2;
} else {
- $this->debugLog(' Path does not match "exclude" rule: %s', $rule);
+ $console->writeLog(
+ " Path does not match \"exclude\" rule: %s\n",
+ $rule);
}
}
}
- $this->debugLog(' Path matches.');
+ $console->writeLog(" Path matches.\n");
$match[] = $path;
}
@@ -194,16 +195,4 @@
}
}
- private function debugLog($pattern /* , $arg, ... */) {
- if (!$this->debugMode) {
- return;
- }
-
- $console = PhutilConsole::getConsole();
- $argv = func_get_args();
- $argv[0] .= "\n";
- call_user_func_array(array($console, 'writeErr'), $argv);
- }
-
-
}

File Metadata

Mime Type
text/plain
Expires
Sun, Jan 19, 2:02 AM (1 h, 29 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7015394
Default Alt Text
D9021.id.diff (4 KB)

Event Timeline