Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F12428771
D2754.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D2754.diff
View Options
diff --git a/.arclint b/.arclint
--- a/.arclint
+++ b/.arclint
@@ -14,6 +14,7 @@
},
"autopep8": {
"type": "autopep8",
+ "version": ">=1.3.4",
"include": "(\\.py$)"
},
"flake8": {
diff --git a/arcanist/linter/AutoPEP8Linter.php b/arcanist/linter/AutoPEP8Linter.php
--- a/arcanist/linter/AutoPEP8Linter.php
+++ b/arcanist/linter/AutoPEP8Linter.php
@@ -35,6 +35,29 @@
public function getDefaultBinary() {
return 'autopep8';
}
+
+ public function getVersion() {
+ list($stdout, $stderr) = execx('%C --version',
+ $this->getExecutableCommand());
+ $matches = array();
+
+ /* Support a.b or a.b.c version numbering scheme */
+ $regex = '/^autopep8 (?P<version>\d+\.\d+(?:\.\d+)?)/';
+
+ /*
+ * Old autopep8 output the version to stdout, newer output to stderr.
+ * Try both to determine the version.
+ */
+ if (preg_match($regex, $stdout, $matches)) {
+ return $matches['version'];
+ }
+ if (preg_match($regex, $stderr, $matches)) {
+ return $matches['version'];
+ }
+
+ return false;
+ }
+
public function getInstallInstructions() {
return pht('Make sure autopep8 is in directory specified by $PATH');
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Dec 28, 19:38 (8 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4844974
Default Alt Text
D2754.diff (1 KB)
Attached To
D2754: [LINTER] Enforce a minimum version for autopep8
Event Timeline
Log In to Comment