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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ All notable changes to this project are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and versions follow
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.3] - 2026-08-12

### Fixed

- Make `--ascii` escape non-ASCII text in source paths and other report
content, so the option now guarantees an entirely ASCII terminal report.
Normal terminal and JSON output continue to preserve Unicode.

## [0.1.2] - 2026-08-11

### Security
Expand Down Expand Up @@ -52,6 +60,7 @@ First release.
and colour handling that honours `NO_COLOR`.
- Exit code 2 for a breaking upgrade, 1 for the tool itself failing.

[0.1.3]: https://github.com/CAOShurong/willitbreak/compare/v0.1.2...v0.1.3
[0.1.2]: https://github.com/CAOShurong/willitbreak/compare/v0.1.1...v0.1.2
[0.1.1]: https://github.com/CAOShurong/willitbreak/compare/v0.1.0...v0.1.1
[0.1.0]: https://github.com/CAOShurong/willitbreak/releases/tag/v0.1.0
2 changes: 1 addition & 1 deletion src/willitbreak/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .surface import Surface, Symbol, read_surface
from .usage import Reference, scan_paths, scan_source

__version__ = "0.1.2"
__version__ = "0.1.3"

__all__ = [
"Change",
Expand Down
5 changes: 4 additions & 1 deletion src/willitbreak/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,10 @@ def render(outcome: Outcome, palette: Palette, *, ascii_only: bool = False) -> s
"bad",
)
)
return "\n".join(rows)
text = "\n".join(rows)
if ascii_only:
return text.encode("ascii", errors="backslashreplace").decode("ascii")
return text


def _call_shape(reference: Reference, ascii_only: bool) -> str:
Expand Down
11 changes: 11 additions & 0 deletions tests/test_render.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import io
import re
import unittest
from dataclasses import replace

from support import PackageCase

Expand Down Expand Up @@ -48,6 +49,16 @@ def test_ascii_mode_emits_only_ascii(self):
text = render(self.outcome_with_break(), Palette("never"), ascii_only=True)
text.encode("ascii", errors="strict")

def test_ascii_mode_escapes_a_unicode_source_path(self):
outcome = self.outcome_with_break()
reference = outcome.findings[0].references[0]
outcome.findings[0].references[0] = replace(reference, path="目录/调用_Ω.py")

text = render(outcome, Palette("never"), ascii_only=True)

text.encode("ascii", errors="strict")
self.assertIn(r"\u76ee\u5f55/\u8c03\u7528_\u03a9.py:2", text)

def test_unicode_mode_uses_the_arrow(self):
self.assertIn("→", render(self.outcome_with_break(), Palette("never")))

Expand Down