Page MenuHomePhabricator

D21504.diff
No OneTemporary

D21504.diff

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
@@ -35,7 +35,8 @@
list($stdout) = execx('%C --version', $this->getExecutableCommand());
$matches = array();
- if (preg_match('/^(?P<version>\d+\.\d+\.\d+)$/', $stdout, $matches)) {
+ $pattern = '/^(?P<version>\d+\.\d+\.\d+)( Python.*)?$/';
+ if (preg_match($pattern, $stdout, $matches)) {
return $matches['version'];
} else {
return false;
@@ -52,7 +53,8 @@
$messages = array();
foreach ($lines as $line) {
$matches = null;
- if (!preg_match('/^(.*?):(\d+): (.*)$/', $line, $matches)) {
+ $pattern = '/^(?<path>.*?):(?<line>\d+):(?<column>\d*) (?<message>.*)$/';
+ if (!preg_match($pattern, $line, $matches)) {
continue;
}
foreach ($matches as $key => $match) {
@@ -60,7 +62,7 @@
}
$severity = ArcanistLintSeverity::SEVERITY_WARNING;
- $description = $matches[3];
+ $description = $matches['message'];
$error_regexp = '/(^undefined|^duplicate|before assignment$)/';
if (preg_match($error_regexp, $description)) {
@@ -69,7 +71,10 @@
$message = new ArcanistLintMessage();
$message->setPath($path);
- $message->setLine($matches[2]);
+ $message->setLine($matches['line']);
+ if ($matches['column'] != '') {
+ $message->setChar($matches['column']);
+ }
$message->setCode($this->getLinterName());
$message->setName($this->getLinterName());
$message->setDescription($description);
diff --git a/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test b/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test
--- a/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test
+++ b/src/lint/linter/__tests__/pyflakes/pyflakes.lint-test
@@ -2,6 +2,6 @@
x += 1
~~~~~~~~~~
-warning:1:0
-warning:1:0
-error:3:0
+warning:1:
+warning:1:
+error:3:

File Metadata

Mime Type
text/plain
Expires
Mon, May 13, 9:52 PM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6277492
Default Alt Text
D21504.diff (1 KB)

Event Timeline