diff options
author | Clément Pit-Claudel <cpitclaudel@users.noreply.github.com> | 2020-04-03 13:01:53 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 15:01:53 +0200 |
commit | 8adc42049f9998e19fefbb9f8ef97e984dd3c3ad (patch) | |
tree | 14fd40a51d72704789d06723c84fba7d3e8f82d9 | |
parent | 392b062ac053fec2722481b9c01178a707244eb7 (diff) | |
download | pylint-git-8adc42049f9998e19fefbb9f8ef97e984dd3c3ad.tar.gz |
Don't HTML-escape JSON messages (#3467)
The JSON module already escapes special characters as needed.
This was already reported in #2769 and partially addressed by
6b1adc668727ebfbd84763b14b65676cc11febec, but that commit still quotes angle
brackets ('<' and '>').
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | pylint/reporters/json_reporter.py | 3 | ||||
-rw-r--r-- | tests/test_self.py | 1 |
3 files changed, 5 insertions, 2 deletions
@@ -7,6 +7,9 @@ What's New in Pylint 2.5.0? Release date: TBA +* Remove HTML quoting of messages in JSON output. + + Close #2769 * Adjust the `invalid-name` rule to work with non-ASCII identifiers and add the `non-ascii-name` rule. diff --git a/pylint/reporters/json_reporter.py b/pylint/reporters/json_reporter.py index 48c83837f..8cdb82957 100644 --- a/pylint/reporters/json_reporter.py +++ b/pylint/reporters/json_reporter.py @@ -7,7 +7,6 @@ # For details: https://github.com/PyCQA/pylint/blob/master/COPYING """JSON reporter""" -import html import json import sys @@ -37,7 +36,7 @@ class JSONReporter(BaseReporter): "column": msg.column, "path": msg.path, "symbol": msg.symbol, - "message": html.escape(msg.msg or "", quote=False), + "message": msg.msg or "", "message-id": msg.msg_id, } ) diff --git a/tests/test_self.py b/tests/test_self.py index 5cb52a5b4..017bf9a0c 100644 --- a/tests/test_self.py +++ b/tests/test_self.py @@ -347,6 +347,7 @@ class TestRunTC: assert key in message assert message[key] == value assert "invalid syntax" in message["message"].lower() + assert "<unknown>" in message["message"].lower() def test_json_report_when_file_is_missing(self): out = StringIO() |