Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion mypy/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,8 @@ def __init__(self, reports: Reports, output_dir: str) -> None:

# XML doesn't like control characters, but they are sometimes
# legal in source code (e.g. comments, string literals).
control_fixer = str.maketrans(''.join(chr(i) for i in range(32)), '?' * 32)
# Tabs (#x09) are allowed in XML content.
control_fixer = str.maketrans(''.join(chr(i) for i in range(32) if i != 9), '?' * 31)

def on_file(self,
tree: MypyFile,
Expand Down
4 changes: 2 additions & 2 deletions test-data/unit/reports.test
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def untyped_function():
# cmd: mypy --html-report report n.py
[file n.py]
class A(object):
pass # hex 1f here: ()
pass # line indented with tab; hex 1f here: ()

[file report/mypy-html.css]
[file report/index.html]
Expand All @@ -96,7 +96,7 @@ class A(object):
<span id="L2" class="lineno"><a class="lineno" href="#L2">2</a></span>
</pre></td>
<td class="table-code"><pre><span class="line-empty" title="No Anys on this line!">class A(object):</span>
<span class="line-empty" title="No Anys on this line!"> pass # hex 1f here: (?)</span>
<span class="line-empty" title="No Anys on this line!">pass # line indented with tab; hex 1f here: (?)</span>
</pre></td>
</tr></tbody>
</table>
Expand Down