]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Don't lint file content of directories
authorvrana <jakubv@fb.com>
Thu, 18 Oct 2012 21:17:29 +0000 (14:17 -0700)
committervrana <jakubv@fb.com>
Fri, 19 Oct 2012 18:38:44 +0000 (11:38 -0700)
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

index d3f1a71d0164ff7a7afc6c5d8ee098917ddebdb5..cf2e46cd87993d036e6bc0b7babf4a936d0d47db 100644 (file)
@@ -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));
       }
     }