You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here the diff is confusing because it looks like the original string doesn't even have matching quotes, just a single quote char. In fact it has two quotes, but the intervening backspace character deleted one of them. (Note this is the same behavior shown by cat without -v; it just allows control characters to take effect.)
Interestingly, this is also the same as the default behavior of both diff and git diff, which means we may want to be cautious about diverging from it. But we could consider doing some kind of escaping of non-printable characters before outputting code frames or diffs.
The text was updated successfully, but these errors were encountered:
Search keyword used: "non-printable"
Python source code containing non-printable chars (e.g.
^H
or backspace,^Z
or substitution,^[
or escape; see https://github.com/astral-sh/ruff/blob/main/crates/ruff_linter/resources/test/fixtures/pylint/invalid_characters.py for examples) can cause unpredictable and confusing results if we output it as-is.Here's a minimal example of the current behavior:
Here the diff is confusing because it looks like the original string doesn't even have matching quotes, just a single quote char. In fact it has two quotes, but the intervening backspace character deleted one of them. (Note this is the same behavior shown by
cat
without-v
; it just allows control characters to take effect.)Interestingly, this is also the same as the default behavior of both
diff
andgit diff
, which means we may want to be cautious about diverging from it. But we could consider doing some kind of escaping of non-printable characters before outputting code frames or diffs.The text was updated successfully, but these errors were encountered: