Page MenuHomePhabricator

D8971.diff
No OneTemporary

D8971.diff

diff --git a/src/lint/linter/ArcanistCSSLintLinter.php b/src/lint/linter/ArcanistCSSLintLinter.php
--- a/src/lint/linter/ArcanistCSSLintLinter.php
+++ b/src/lint/linter/ArcanistCSSLintLinter.php
@@ -34,6 +34,17 @@
return $config->getConfigFromAnySource('lint.csslint.bin', 'csslint');
}
+ public function getVersion() {
+ list($stdout) = execx('%C --version', $this->getExecutableCommand());
+
+ $matches = array();
+ if (preg_match('/^v(?P<version>\d+\.\d+\.\d+)$/', $stdout, $matches)) {
+ return $matches['version'];
+ } else {
+ return false;
+ }
+ }
+
public function getInstallInstructions() {
return pht('Install CSSLint using `npm install -g csslint`.');
}
diff --git a/src/lint/linter/ArcanistExternalLinter.php b/src/lint/linter/ArcanistExternalLinter.php
--- a/src/lint/linter/ArcanistExternalLinter.php
+++ b/src/lint/linter/ArcanistExternalLinter.php
@@ -369,6 +369,21 @@
return array_merge($mandatory_flags, $flags);
}
+ public function getCacheVersion() {
+ $version = $this->getVersion();
+
+ if ($version) {
+ return $version.'-'.json_encode($this->getCommandFlags());
+ } else {
+ // Either we failed to parse the version number or the `getVersion`
+ // function hasn't been implemented.
+ return json_encode($this->getCommandFlags());
+ }
+ }
+
+ public function getVersion() {
+ return null;
+ }
protected function buildFutures(array $paths) {
$executable = $this->getExecutableCommand();
diff --git a/src/lint/linter/ArcanistFlake8Linter.php b/src/lint/linter/ArcanistFlake8Linter.php
--- a/src/lint/linter/ArcanistFlake8Linter.php
+++ b/src/lint/linter/ArcanistFlake8Linter.php
@@ -34,6 +34,17 @@
return 'flake8';
}
+ public function getVersion() {
+ list($stdout) = execx('%C --version', $this->getExecutableCommand());
+
+ $matches = array();
+ if (preg_match('/^(?P<version>\d+\.\d+\.\d+)\b/', $stdout, $matches)) {
+ return $matches['version'];
+ } else {
+ return false;
+ }
+ }
+
public function getInstallInstructions() {
return pht('Install flake8 using `easy_install flake8`.');
}
diff --git a/src/lint/linter/ArcanistJSHintLinter.php b/src/lint/linter/ArcanistJSHintLinter.php
--- a/src/lint/linter/ArcanistJSHintLinter.php
+++ b/src/lint/linter/ArcanistJSHintLinter.php
@@ -35,18 +35,16 @@
}
}
- public function getCacheVersion() {
+ public function getVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
- // Extract version number from standard output.
$matches = array();
- if (preg_match('/^jshint v(\d+\.\d+\.\d+)$/', $stdout, $matches)) {
- $version = $matches[1];
+ $regex = '/^jshint v(?P<version>\d+\.\d+\.\d+)$/';
+ if (preg_match($regex, $stdout, $matches)) {
+ return $matches['version'];
} else {
- $version = md5($stdout);
+ return false;
}
-
- return $version . '-' . md5(json_encode($this->getCommandFlags()));
}
public function getInstallInstructions() {
diff --git a/src/lint/linter/ArcanistPEP8Linter.php b/src/lint/linter/ArcanistPEP8Linter.php
--- a/src/lint/linter/ArcanistPEP8Linter.php
+++ b/src/lint/linter/ArcanistPEP8Linter.php
@@ -15,11 +15,6 @@
return 'pep8';
}
- public function getCacheVersion() {
- list($stdout) = execx('%C --version', $this->getExecutableCommand());
- return $stdout.implode(' ', $this->getCommandFlags());
- }
-
public function getDefaultFlags() {
// TODO: Warn that all of this is deprecated.
$config = $this->getEngine()->getConfigurationManager();
@@ -55,6 +50,17 @@
return $arc_root.'/externals/pep8/pep8.py';
}
+ public function getVersion() {
+ list($stdout) = execx('%C --version', $this->getExecutableCommand());
+
+ $matches = array();
+ if (preg_match('/^(?P<version>\d+\.\d+\.\d+)$/', $stdout, $matches)) {
+ return $matches['version'];
+ } else {
+ return false;
+ }
+ }
+
public function getInstallInstructions() {
return pht('Install PEP8 using `easy_install pep8`.');
}
diff --git a/src/lint/linter/ArcanistPhpcsLinter.php b/src/lint/linter/ArcanistPhpcsLinter.php
--- a/src/lint/linter/ArcanistPhpcsLinter.php
+++ b/src/lint/linter/ArcanistPhpcsLinter.php
@@ -58,6 +58,18 @@
return $config->getConfigFromAnySource('lint.phpcs.bin', 'phpcs');
}
+ public function getVersion() {
+ list($stdout) = execx('%C --version', $this->getExecutableCommand());
+
+ $matches = array();
+ $regex = '/^PHP_CodeSniffer version (?P<version>\d+\.\d+\.\d+)\b/';
+ if (preg_match($regex, $stdout, $matches)) {
+ return $matches['version'];
+ } else {
+ return false;
+ }
+ }
+
public function shouldExpectCommandErrors() {
return true;
}
diff --git a/src/lint/linter/ArcanistRubyLinter.php b/src/lint/linter/ArcanistRubyLinter.php
--- a/src/lint/linter/ArcanistRubyLinter.php
+++ b/src/lint/linter/ArcanistRubyLinter.php
@@ -26,6 +26,18 @@
return 'ruby';
}
+ public function getVersion() {
+ list($stdout) = execx('%C --version', $this->getExecutableCommand());
+
+ $matches = array();
+ $regex = '/^ruby (?P<version>\d+\.\d+\.\d+)p\d+/';
+ if (preg_match($regex, $stdout, $matches)) {
+ return $matches['version'];
+ } else {
+ return false;
+ }
+ }
+
public function getInstallInstructions() {
return pht('Install `ruby` from <http://www.ruby-lang.org/>.');
}

File Metadata

Mime Type
text/plain
Expires
Mon, Jun 10, 8:04 AM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6291509
Default Alt Text
D8971.diff (5 KB)

Event Timeline