Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15312006
D21504.id51184.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D21504.id51184.diff
View Options
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
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 7, 1:01 PM (3 d, 9 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7226293
Default Alt Text
D21504.id51184.diff (1 KB)
Attached To
Mode
D21504: Fix pyflakes tests for recent pyflakes versions
Attached
Detach File
Event Timeline
Log In to Comment