Skip to content

Commit

Permalink
XMLBear: Process error correctly
Browse files Browse the repository at this point in the history
Errors were shown as logs instead of errors. Corrected the processing of
output to show the error messages.

Fixes coala#251
  • Loading branch information
vivek425ster committed Mar 18, 2016
1 parent 5421d76 commit ca9a853
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions bears/xml/XMLBear.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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="",
Expand Down

0 comments on commit ca9a853

Please sign in to comment.