]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Allow ArcanistLinter to load files not directly affected by lint
authorepriestley <git@epriestley.com>
Fri, 6 May 2011 15:34:18 +0000 (08:34 -0700)
committerepriestley <git@epriestley.com>
Sun, 8 May 2011 08:43:49 +0000 (01:43 -0700)
Summary:
This is necessary for the Javelin linters. The libphutil and flib linters do it
implicitly, so there's no real tradeoff here.

Test Plan:
Ran javelin linters.

Reviewed By: tuomaspelkonen
Reviewers: tomo, aran, jungejason, tuomaspelkonen
CC: aran, tuomaspelkonen, epriestley
Differential Revision: 238

src/lint/linter/base/ArcanistLinter.php
src/lint/linter/base/__init__.php

index b704c41da9f31e2ac5b8364698956da1246a5d91..4b3bbe23d8e2a3bc299dff585c911e479b145a9f 100644 (file)
@@ -67,12 +67,17 @@ abstract class ArcanistLinter {
 
   protected function getData($path) {
     if (!array_key_exists($path, $this->data)) {
-      throw new Exception("Data is not provided for path '{$path}'!");
+      $disk_path = $this->getEngine()->getFilePathOnDisk($path);
+      if ($disk_path) {
+        $this->data[$path] = Filesystem::readFile($disk_path);
+      } else {
+        throw new Exception("Data is not provided for path '{$path}'!");
+      }
     }
     return $this->data[$path];
   }
 
-  public function setEngine($engine) {
+  public function setEngine(ArcanistLintEngine $engine) {
     $this->engine = $engine;
     return $this;
   }
index 4e79e23c011e5eec57d64f0b032fdb29d72fa5c9..1b364bf590758e63ecc8801daafcc9172c1f8fe8 100644 (file)
@@ -5,8 +5,11 @@
  */
 
 
+
 phutil_require_module('arcanist', 'lint/message');
 phutil_require_module('arcanist', 'lint/severity');
 
+phutil_require_module('phutil', 'filesystem');
+
 
 phutil_require_source('ArcanistLinter.php');