From ca9a853689a10fe41ec1219aebb3af2e5b38be3e Mon Sep 17 00:00:00 2001 From: Vivek Jain Date: Fri, 18 Mar 2016 01:25:41 +0530 Subject: [PATCH] XMLBear: Process error correctly Errors were shown as logs instead of errors. Corrected the processing of output to show the error messages. Fixes https://github.com/coala-analyzer/coala-bears/issues/251 --- bears/xml/XMLBear.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/bears/xml/XMLBear.py b/bears/xml/XMLBear.py index ba27622d5e..43fad2cb22 100644 --- a/bears/xml/XMLBear.py +++ b/bears/xml/XMLBear.py @@ -1,3 +1,5 @@ +import collections + from coalib.bearlib.abstractions.Lint import Lint from coalib.bears.LocalBear import LocalBear from coalib.misc.Shell import escape_path_argument @@ -24,10 +26,16 @@ class XMLBear(LocalBear, Lint): gives_corrected = True def process_output(self, output, filename, file): - if self.stdout_output: # only yield Result if stdout is not empty - return self._process_corrected(self.stdout_output, filename, file) - if self.stderr_output: # pragma: no cover + if self.stderr_output: + self.use_stderr = True + if self.stdout_output: # only yield Result if stdout is not empty + return collections.ChainMap( + self._process_issues(self.stderr_output, filename), + self._process_corrected(self.stdout_output, + filename, file)) return self._process_issues(self.stderr_output, filename) + elif self.stdout_output: # only yield Result if stdout is not empty + return self._process_corrected(self.stdout_output, filename, file) def run(self, filename, file, xml_schema: path="",