Skip to content

Commit

Permalink
fix(test): failure in PyCharm on Ubuntu 22
Browse files Browse the repository at this point in the history
The failure is caused by colorama package producing excessive output at the
process termination. The additional output leads to error when parsing
json.

Details:
1. PyCQA/isort#1657
2. tartley/colorama#307
  • Loading branch information
i-keliukh authored Aug 19, 2022
1 parent 704a180 commit 5b1936d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions universum/analyzers/pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def main(settings: argparse.Namespace) -> List[utils.ReportData]:

def pylint_output_parser(output: str) -> List[utils.ReportData]:
result: List[utils.ReportData] = []
# Workaround for colorama polluting the process output when run from PyCharm - remove the trailing color reset
# escape sequence. Details:
# 1. https://github.com/PyCQA/isort/issues/1657
# 2. https://github.com/tartley/colorama/issues/307
output = output[:output.rfind(']') + 1]
for data in json.loads(output):
# pylint has its own escape rules for json output of "message" values.
# it uses cgi.escape lib and escapes symbols <>&
Expand Down

0 comments on commit 5b1936d

Please sign in to comment.