diff --git a/src/PythonIsortLinter.php b/src/PythonIsortLinter.php index 9db0cf2..a4791f7 100644 --- a/src/PythonIsortLinter.php +++ b/src/PythonIsortLinter.php @@ -58,7 +58,7 @@ public function getVersion() { $this->getExecutableCommand()); $matches = array(); - if (preg_match('/^(?P\d+\.\d+\.\d+)$/', $stderr, $matches)) { + if (preg_match('/^(?P\d+\.\d+\.\d+)$/', $stdout, $matches)) { $this->version = $matches['version']; return $this->version; } else { @@ -89,13 +89,17 @@ protected function parseLinterOutput($path, $err, $stdout, $stderr) { return array(); } - // Expected output includes a single header optionally followed by a - // multiline diff. We're only interested in the latter case (which implies - // a lint violation), but we could also parse the header for more detailed - // information if we need that later. - list($header, $diff) = explode("\n", $stdout, 2); - if (empty($diff)) { + if (version_compare($this->version, '5.5.0', '>=')) { + $diff = $stdout; + } else { + // Expected output includes a single header optionally followed by a + // multiline diff. We're only interested in the latter case (which implies + // a lint violation), but we could also parse the header for more detailed + // information if we need that later. + list($header, $diff) = explode("\n", $stdout, 2); + if (empty($diff)) { return array(); + } } $messages = array();