sourcery-ai / sourcery

Instant AI code reviews
https://sourcery.ai
MIT License
1.53k stars 66 forks source link

Refactoring `simplify-fstring-formatting` replaces newlines with `\x1f` in multiline strings #240

Closed ruancomelli closed 2 years ago

ruancomelli commented 2 years ago

Issue description or question

The simplify-fstring-formatting refactoring is replacing newlines with the \x1f character in multiline strings. For instance,

def ooops():
    return f"""
        Sourcery is
        {f"{'awesome'.upper()}"}
    """

is refactored as

def ooops():
    return f"""\x1f        Sourcery is\x1f        {'awesome'.upper()}\x1f    """

The expected result would be

def ooops():
    return f"""
        Sourcery is
        {'awesome'.upper()}
    """

Sourcery Version

v0.11.5

Code editor or IDE name and version

VS Code 1.67.2

OS name and version

Ubuntu 20.04.4 LTS

bm424 commented 2 years ago

Duplicate of https://github.com/sourcery-ai/core/issues/1492

Hellebore commented 2 years ago

Addressed with release of 0.12.1