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 #251
  • Loading branch information
vivek425ster committed Mar 20, 2016
1 parent 0baf3e0 commit 7e6081e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
15 changes: 12 additions & 3 deletions bears/xml/XMLBear.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import itertools

from coalib.bearlib.abstractions.Lint import Lint
from coalib.bears.LocalBear import LocalBear
from coalib.misc.Shell import escape_path_argument
Expand All @@ -24,11 +26,18 @@ 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:
return itertools.chain(
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:
return self._process_issues(self.stderr_output, filename)


This comment has been minimized.

Copy link
@gitmate-bot

gitmate-bot Mar 20, 2016

Collaborator

The code does not comply to PEP8.

PEP8Bear, severity NORMAL, section autopep8.

def run(self, filename, file,
xml_schema: path="",
xml_dtd: path_or_url=""):
Expand Down
1 change: 0 additions & 1 deletion tests/xml/test_files/xsd-error.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0"?>
<note
xmlns="http://www.w3schools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down

0 comments on commit 7e6081e

Please sign in to comment.