]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Load files which we don't directly examine, since there are some common cases
authorepriestley <epriestley@phabricator.com>
Sun, 10 Apr 2011 23:05:44 +0000 (16:05 -0700)
committerepriestley <epriestley@phabricator.com>
Sun, 10 Apr 2011 23:05:44 +0000 (16:05 -0700)
where we either generate an entire file or an external script examines it.

src/lint/engine/base/ArcanistLintEngine.php

index 7d51b6036cb84528caf8b058094b1e1475381d0a..053b72aace665394a1d548790393133d9c98a1cc 100644 (file)
@@ -172,11 +172,16 @@ abstract class ArcanistLintEngine {
     }
 
     foreach ($this->results as $path => $result) {
-      $result->setFilePathOnDisk($this->getFilePathOnDisk($path));
+      $disk_path = $this->getFilePathOnDisk($path);
+      $result->setFilePathOnDisk($disk_path);
       if (isset($this->fileData[$path])) {
-        // Only set the data if any linter loaded it. The goal here is to
-        // avoid binaries when we don't actually care about their contents,
-        // for performance.
+        $result->setData($this->fileData[$path]);
+      } else if ($disk_path) {
+        // TODO: this may cause us to, e.g., load a large binary when we only
+        // raised an error about its filename. We could refine this by looking
+        // through the lint messages and doing this load only if any of them
+        // have original/replacement text or something like that.
+        $this->fileData[$path] = Filesystem::readFile($path);
         $result->setData($this->fileData[$path]);
       }
     }