]> khamidou — GitHub mirrors - arcanist.git/commitdiff
Remove support for passing data via STDIN
authorJoshua Spence <josh@joshuaspence.com>
Tue, 5 May 2015 10:55:49 +0000 (20:55 +1000)
committerJoshua Spence <josh@joshuaspence.com>
Tue, 5 May 2015 10:55:49 +0000 (20:55 +1000)
Summary: Ref T7674. Remove support for passing data to linters via `STDIN`. This functionality exists primarily for pre-receive workflows (which don't have a working copy to act on), but these workflows are going away soon.

Test Plan: `arc unit`

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T7674

Differential Revision: https://secure.phabricator.com/D12696

12 files changed:
src/lint/engine/ArcanistLintEngine.php
src/lint/linter/ArcanistClosureLinter.php
src/lint/linter/ArcanistCoffeeLintLinter.php
src/lint/linter/ArcanistCpplintLinter.php
src/lint/linter/ArcanistExternalLinter.php
src/lint/linter/ArcanistHLintLinter.php
src/lint/linter/ArcanistJSONLintLinter.php
src/lint/linter/ArcanistLesscLinter.php
src/lint/linter/ArcanistPhpLinter.php
src/lint/linter/ArcanistPhpcsLinter.php
src/lint/linter/ArcanistPyFlakesLinter.php
src/lint/linter/ArcanistRubyLinter.php

index b98a4514566fd74d47c1b7141a0e15eace1caf36..8a4d1212e194c2b415605e95f39e3e980bcd015b 100644 (file)
@@ -144,8 +144,8 @@ abstract class ArcanistLintEngine {
         $this->fileData[$path] = $this->getHookAPI()
           ->getCurrentFileData($path);
       } else {
-        $disk_path = $this->getFilePathOnDisk($path);
-        $this->fileData[$path] = Filesystem::readFile($disk_path);
+      $disk_path = $this->getFilePathOnDisk($path);
+      $this->fileData[$path] = Filesystem::readFile($disk_path);
       }
     }
     return $this->fileData[$path];
index e6f771875f67f6626f3c03cbb9bcb134f6ebde71..78d4d428f1039949bf8f7e3aacb9f936d24a380b 100644 (file)
@@ -37,10 +37,6 @@ final class ArcanistClosureLinter extends ArcanistExternalLinter {
       'files/closure_linter-latest.tar.gz');
   }
 
-  public function supportsReadDataFromStdin() {
-    return false;
-  }
-
   protected function parseLinterOutput($path, $err, $stdout, $stderr) {
     $lines = phutil_split_lines($stdout, false);
     $messages = array();
index 663190375f34149c0c314ebba71101a0768d44af..3301356a4958e53c54d0f696ad005ff56646f990 100644 (file)
@@ -47,14 +47,6 @@ final class ArcanistCoffeeLintLinter extends ArcanistExternalLinter {
       'npm install -g coffeelint');
   }
 
-  public function supportsReadDataFromStdin() {
-    return true;
-  }
-
-  public function getReadDataFromStdinFilename() {
-    return '--stdin';
-  }
-
   protected function getMandatoryFlags() {
     $options = array(
       '--reporter=raw',
index 0e3f5b66dbc597a47f741cfeae61bc740f00f815..7d8b4bbc79ce3b79553838fe0dd4bd5d639296e4 100644 (file)
@@ -29,14 +29,6 @@ final class ArcanistCpplintLinter extends ArcanistExternalLinter {
       'googlecode.com/svn/trunk/cpplint/cpplint.py`.');
   }
 
-  public function supportsReadDataFromStdin() {
-    return true;
-  }
-
-  public function getReadDataFromStdinFilename() {
-    return '-';
-  }
-
   protected function getDefaultFlags() {
     return $this->getDeprecatedConfiguration('lint.cpplint.options', array());
   }
index 08f3e5cb79c3d41f9fa197cd91f0343a500e92f9..b8aceb8e2e61da874140b7043764f5f5ed4af72b 100644 (file)
@@ -59,50 +59,6 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter {
     return true;
   }
 
-  /**
-   * Return true to indicate that the external linter can read input from
-   * stdin, rather than requiring a file. If this mode is supported, it is
-   * slightly more flexible and may perform better, and is thus preferable.
-   *
-   * To send data over stdin instead of via a command line parameter, override
-   * this method and return true. If the linter also needs a command line
-   * flag (like `--stdin` or `-`), override
-   * @{method:getReadDataFromStdinFilename} to provide it.
-   *
-   * For example, linters are normally invoked something like this:
-   *
-   *   $ linter file.js
-   *
-   * If you override this method, invocation will be more similar to this:
-   *
-   *   $ linter < file.js
-   *
-   * If you additionally override @{method:getReadDataFromStdinFilename} to
-   * return `"-"`, invocation will be similar to this:
-   *
-   *   $ linter - < file.js
-   *
-   * @return bool True to send data over stdin.
-   * @task bin
-   */
-  public function supportsReadDataFromStdin() {
-    return false;
-  }
-
-  /**
-   * If the linter can read data over stdin, override
-   * @{method:supportsReadDataFromStdin} and then optionally override this
-   * method to provide any required arguments (like `-` or `--stdin`). See
-   * that method for discussion.
-   *
-   * @return string|null  Additional arguments required by the linter when
-   *                      operating in stdin mode.
-   * @task bin
-   */
-  public function getReadDataFromStdinFilename() {
-    return null;
-  }
-
   /**
    * Provide mandatory, non-overridable flags to the linter. Generally these
    * are format flags, like `--format=xml`, which must always be given for
@@ -373,18 +329,9 @@ abstract class ArcanistExternalLinter extends ArcanistFutureLinter {
 
     $futures = array();
     foreach ($paths as $path) {
-      if ($this->supportsReadDataFromStdin()) {
-        $future = new ExecFuture(
-          '%C %C',
-          $bin,
-          $this->getReadDataFromStdinFilename());
-        $future->write($this->getEngine()->loadData($path));
-      } else {
-        // TODO: In commit hook mode, we need to do more handling here.
-        $disk_path = $this->getEngine()->getFilePathOnDisk($path);
-        $path_argument = $this->getPathArgumentForLinterFuture($disk_path);
-        $future = new ExecFuture('%C %C', $bin, $path_argument);
-      }
+      $disk_path = $this->getEngine()->getFilePathOnDisk($path);
+      $path_argument = $this->getPathArgumentForLinterFuture($disk_path);
+      $future = new ExecFuture('%C %C', $bin, $path_argument);
 
       $future->setCWD($this->getEngine()->getWorkingCopy()->getProjectRoot());
       $futures[$path] = $future;
index df22c25b95bf160b7bf401faace6d09fbd248984..6274e045714bd75b47d8f451c211cff409471e5f 100644 (file)
@@ -33,14 +33,6 @@ final class ArcanistHLintLinter extends ArcanistExternalLinter {
     return pht('Install hlint with `cabal install hlint`.');
   }
 
-  public function supportsReadDataFromStdin() {
-    return true;
-  }
-
-  public function getReadDataFromStdinFilename() {
-    return '-';
-  }
-
   protected function getMandatoryFlags() {
     return array('--json');
   }
index 064782f84a97e3999dd5143bebf9eb6b27b447bd..b4a65bdfc0876b30b01d1a0743f4796b7da9ea59 100644 (file)
@@ -47,10 +47,6 @@ final class ArcanistJSONLintLinter extends ArcanistExternalLinter {
     return pht('Install jsonlint using `npm install -g jsonlint`.');
   }
 
-  public function supportsReadDataFromStdin() {
-    return true;
-  }
-
   protected function getMandatoryFlags() {
     return array(
       '--compact',
index f225bb35a40ad0f522f24db81a7de449419b3495..5516540baceb25f3a505395d454afde19d89b933 100644 (file)
@@ -101,17 +101,6 @@ final class ArcanistLesscLinter extends ArcanistExternalLinter {
     return pht('Install lessc using `npm install -g less`.');
   }
 
-  public function supportsReadDataFromStdin() {
-    // Technically `lessc` can read data from standard input however, when doing
-    // so, relative imports cannot be resolved. Therefore, this functionality is
-    // disabled.
-    return false;
-  }
-
-  public function getReadDataFromStdinFilename() {
-    return '-';
-  }
-
   protected function getMandatoryFlags() {
     return array(
       '--lint',
index 328e87cee1c2ad2b52be9e386a610b64f1da7ff4..bd6b82224901a03cb19a5d308ceaec2b70b95163 100644 (file)
@@ -55,10 +55,6 @@ final class ArcanistPhpLinter extends ArcanistExternalLinter {
     return $stdout;
   }
 
-  public function supportsReadDataFromStdin() {
-    return false;
-  }
-
   protected function canCustomizeLintSeverities() {
     return false;
   }
index 8475c55ab18698900ba7b4b0aef1437e0c75d0e2..68d4d7f36bf56bc798deb16f5337ea849446bf12 100644 (file)
@@ -96,10 +96,6 @@ final class ArcanistPhpcsLinter extends ArcanistExternalLinter {
     }
   }
 
-  public function supportsReadDataFromStdin() {
-    return true;
-  }
-
   protected function parseLinterOutput($path, $err, $stdout, $stderr) {
     // NOTE: Some version of PHPCS after 1.4.6 stopped printing a valid, empty
     // XML document to stdout in the case of no errors. If PHPCS exits with
index 4180fc905bf6ff76104b21f0ded39966ec1eee39..59d919950aba6ee7e9a79b82b427d753330875ea 100644 (file)
@@ -53,10 +53,6 @@ final class ArcanistPyFlakesLinter extends ArcanistExternalLinter {
     return pht('Install pyflakes with `pip install pyflakes`.');
   }
 
-  public function supportsReadDataFromStdin() {
-    return true;
-  }
-
   protected function parseLinterOutput($path, $err, $stdout, $stderr) {
     $lines = phutil_split_lines($stdout, false);
 
index bdf3ab8217d48be774f3b1c82fcb7cc90585d52c..b2d765679131f6cc305b76011a1707ccc9c8c758 100644 (file)
@@ -50,10 +50,6 @@ final class ArcanistRubyLinter extends ArcanistExternalLinter {
     return pht('Install `ruby` from <http://www.ruby-lang.org/>.');
   }
 
-  public function supportsReadDataFromStdin() {
-    return true;
-  }
-
   protected function getMandatoryFlags() {
     // -w: turn on warnings
     // -c: check syntax