Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15399907
D17552.id42219.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
D17552.id42219.diff
View Options
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
@@ -51,12 +51,14 @@
protected function parseLinterOutput($path, $err, $stdout, $stderr) {
$lines = phutil_split_lines($stdout, false);
+ // stdin:2: W802 undefined name 'foo' # pyflakes
+ // stdin:3:1: E302 expected 2 blank lines, found 1 # pep8
+ $regexp =
+ '/^(?:.*?):(?P<line>\d+):(?:(?P<char>\d+):)? (?P<code>\S+) (?P<msg>.*)$/';
+
$messages = array();
foreach ($lines as $line) {
$matches = null;
- // stdin:2: W802 undefined name 'foo' # pyflakes
- // stdin:3:1: E302 expected 2 blank lines, found 1 # pep8
- $regexp = '/^(.*?):(\d+):(?:(\d+):)? (\S+) (.*)$/';
if (!preg_match($regexp, $line, $matches)) {
continue;
}
@@ -66,14 +68,14 @@
$message = new ArcanistLintMessage();
$message->setPath($path);
- $message->setLine($matches[2]);
- if (!empty($matches[3])) {
- $message->setChar($matches[3]);
+ $message->setLine($matches['line']);
+ if (!empty($matches['char'])) {
+ $message->setChar($matches['char']);
}
- $message->setCode($matches[4]);
- $message->setName($this->getLinterName().' '.$matches[3]);
- $message->setDescription($matches[5]);
- $message->setSeverity($this->getLintMessageSeverity($matches[4]));
+ $message->setCode($matches['code']);
+ $message->setName($this->getLinterName().' '.$matches['code']);
+ $message->setDescription($matches['msg']);
+ $message->setSeverity($this->getLintMessageSeverity($matches['code']));
$messages[] = $message;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 18, 8:26 AM (1 w, 7 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7709540
Default Alt Text
D17552.id42219.diff (1 KB)
Attached To
Mode
D17552: Improve the flake8 line-matching regex
Attached
Detach File
Event Timeline
Log In to Comment