pythonpython-3.xformatterlinterruff

Ruff formater lengthens the string, how to make sure that it does not change strings that are already less than the length specified in the settings


The problem is that this is the line:

__all__ = (
    "Base",
    "TimestampMixin",
    "BaseUser",
    "User",
    "Locale",
    "DBBot"
)

It turns you into such a

__all__ = ("Base", "TimestampMixin", "BaseUser", "User", "Locale", "DBBot")

Solution

  • Add a trailing comma (Ruff playground):

    __all__ = (
        "Base",
        "TimestampMixin",
        "BaseUser",
        "User",
        "Locale",
        "DBBot",
    )