1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +01:00

Remove support for passing data via STDIN

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
This commit is contained in:
Joshua Spence 2015-05-05 20:55:49 +10:00
parent 0a711315f8
commit 4330b27c07
12 changed files with 5 additions and 117 deletions

View 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];

View 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();

View 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',

View 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());
}

View 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;

View 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');
}

View 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',

View 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',

View file

@ -55,10 +55,6 @@ final class ArcanistPhpLinter extends ArcanistExternalLinter {
return $stdout;
}
public function supportsReadDataFromStdin() {
return false;
}
protected function canCustomizeLintSeverities() {
return false;
}

View 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

View 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);

View 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