From 4585ab7363314ac70d277d9a6318811627a1e84d Mon Sep 17 00:00:00 2001 From: vrana Date: Thu, 18 Oct 2012 14:17:29 -0700 Subject: [PATCH] Don't lint file content of directories Summary: This also changes how we treat `@generated` and `@nolint` - after this diff, we will still lint their path. Test Plan: Created directory `a.php` and symlink `b.php` pointing to directory. `arc lint` previously printed: > Requested path `/data/users/jakubv/devtools/arcanist/_.php' is not a file. Now it prints: > No lint warnings. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3737 --- src/lint/engine/PhutilLintEngine.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lint/engine/PhutilLintEngine.php b/src/lint/engine/PhutilLintEngine.php index d3f1a71d..cf2e46cd 100644 --- a/src/lint/engine/PhutilLintEngine.php +++ b/src/lint/engine/PhutilLintEngine.php @@ -48,6 +48,15 @@ class PhutilLintEngine extends ArcanistLintEngine { } } + $name_linter = new ArcanistFilenameLinter(); + $linters[] = $name_linter; + foreach ($paths as $key => $path) { + $name_linter->addPath($path); + if (!is_file($path)) { + unset($paths[$key]); + } + } + $generated_linter = new ArcanistGeneratedLinter(); $linters[] = $generated_linter; @@ -79,13 +88,6 @@ class PhutilLintEngine extends ArcanistLintEngine { } } - $name_linter = new ArcanistFilenameLinter(); - $linters[] = $name_linter; - foreach ($paths as $path) { - $name_linter->addPath($path); - } - - $xhpast_linter = new ArcanistXHPASTLinter(); $xhpast_map = $this->getXHPASTSeverityMap(); $xhpast_linter->setCustomSeverityMap($xhpast_map); @@ -101,10 +103,8 @@ class PhutilLintEngine extends ArcanistLintEngine { $linters[] = $license_linter; foreach ($paths as $path) { if (preg_match('/\.(php|cpp|hpp|l|y)$/', $path)) { - if (!preg_match('@^externals/@', $path)) { - $license_linter->addPath($path); - $license_linter->addData($path, $this->loadData($path)); - } + $license_linter->addPath($path); + $license_linter->addData($path, $this->loadData($path)); } }