Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15625543
D11315.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
7 KB
Referenced Files
None
Subscribers
None
D11315.diff
View Options
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
@@ -41,7 +41,7 @@
return $this->getDeprecatedConfiguration('lint.csslint.bin', 'csslint');
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
diff --git a/src/lint/linter/ArcanistCoffeeLintLinter.php b/src/lint/linter/ArcanistCoffeeLintLinter.php
--- a/src/lint/linter/ArcanistCoffeeLintLinter.php
+++ b/src/lint/linter/ArcanistCoffeeLintLinter.php
@@ -30,7 +30,7 @@
return 'coffeelint';
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
diff --git a/src/lint/linter/ArcanistCppcheckLinter.php b/src/lint/linter/ArcanistCppcheckLinter.php
--- a/src/lint/linter/ArcanistCppcheckLinter.php
+++ b/src/lint/linter/ArcanistCppcheckLinter.php
@@ -36,7 +36,7 @@
}
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
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
@@ -366,6 +366,22 @@
}
}
+ public /* final */ function getVersion() {
+ static $version = null;
+
+ // Cache the version so that we don't make lots of calls to
+ // `$LINTER --version`.
+ if (!$version) {
+ $version = $this->getActualVersion();
+ }
+
+ return $version;
+ }
+
+ protected function getActualVersion() {
+ return null;
+ }
+
/**
* Prepare the path to be added to the command string.
*
@@ -406,6 +422,14 @@
}
final protected function resolveFuture($path, Future $future) {
+ $method = new ReflectionMethod($this, 'getVersion');
+
+ if ($method->getDeclaringClass()->getName() != __CLASS__) {
+ phutil_deprecated(
+ 'The getVersion() method.',
+ 'You should rename this method to getActualVersion().');
+ }
+
list($err, $stdout, $stderr) = $future->resolve();
if ($err && !$this->shouldExpectCommandErrors()) {
$future->resolvex();
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
@@ -43,7 +43,7 @@
}
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
diff --git a/src/lint/linter/ArcanistHLintLinter.php b/src/lint/linter/ArcanistHLintLinter.php
--- a/src/lint/linter/ArcanistHLintLinter.php
+++ b/src/lint/linter/ArcanistHLintLinter.php
@@ -45,7 +45,7 @@
return array('--json');
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout, $stderr) = execx(
'%C --version', $this->getExecutableCommand());
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
@@ -54,7 +54,7 @@
}
}
- public function getVersion() {
+ protected function getActualVersion() {
// NOTE: `jshint --version` emits version information on stderr, not stdout.
list($stdout, $stderr) = execx(
'%C --version',
diff --git a/src/lint/linter/ArcanistJSONLintLinter.php b/src/lint/linter/ArcanistJSONLintLinter.php
--- a/src/lint/linter/ArcanistJSONLintLinter.php
+++ b/src/lint/linter/ArcanistJSONLintLinter.php
@@ -29,7 +29,7 @@
return 'jsonlint';
}
- public function getVersion() {
+ public function getActualVersion() {
// NOTE: `jsonlint --version` returns a non-zero exit status.
list($err, $stdout) = exec_manual(
'%C --version',
diff --git a/src/lint/linter/ArcanistJscsLinter.php b/src/lint/linter/ArcanistJscsLinter.php
--- a/src/lint/linter/ArcanistJscsLinter.php
+++ b/src/lint/linter/ArcanistJscsLinter.php
@@ -29,7 +29,7 @@
return 'jscs';
}
- public function getVersion() {
+ public function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
diff --git a/src/lint/linter/ArcanistLesscLinter.php b/src/lint/linter/ArcanistLesscLinter.php
--- a/src/lint/linter/ArcanistLesscLinter.php
+++ b/src/lint/linter/ArcanistLesscLinter.php
@@ -85,7 +85,7 @@
return 'lessc';
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
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
@@ -55,7 +55,7 @@
return $arc_root.'/externals/pep8/pep8.py';
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
diff --git a/src/lint/linter/ArcanistPhpLinter.php b/src/lint/linter/ArcanistPhpLinter.php
--- a/src/lint/linter/ArcanistPhpLinter.php
+++ b/src/lint/linter/ArcanistPhpLinter.php
@@ -47,7 +47,7 @@
return 'php';
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx(
'%C --run %s',
$this->getExecutableCommand(),
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
@@ -56,7 +56,7 @@
return $this->getDeprecatedConfiguration('lint.phpcs.bin', 'phpcs');
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
diff --git a/src/lint/linter/ArcanistPuppetLintLinter.php b/src/lint/linter/ArcanistPuppetLintLinter.php
--- a/src/lint/linter/ArcanistPuppetLintLinter.php
+++ b/src/lint/linter/ArcanistPuppetLintLinter.php
@@ -34,7 +34,7 @@
return 'puppet-lint';
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
diff --git a/src/lint/linter/ArcanistPyFlakesLinter.php b/src/lint/linter/ArcanistPyFlakesLinter.php
--- a/src/lint/linter/ArcanistPyFlakesLinter.php
+++ b/src/lint/linter/ArcanistPyFlakesLinter.php
@@ -38,7 +38,7 @@
}
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
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
@@ -34,7 +34,7 @@
return 'ruby';
}
- public function getVersion() {
+ protected function getActualVersion() {
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, May 19, 8:20 AM (9 h, 58 m)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8005135
Default Alt Text
D11315.diff (7 KB)
Attached To
Mode
D11315: Cache the version for external linters
Attached
Detach File
Event Timeline
Log In to Comment