1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Disable short multi-line string concatenation in Ruff

Discussão em 'Python' iniciado por Stack, Outubro 4, 2024 às 17:12.

  1. Stack

    Stack Membro Participativo

    If I have an intentionally short multi-line string like this:

    html += (
    '<p>Regards,</p>\n'
    '<p>Tom Cruise</p>\n'
    )


    Ruff will automatically reformat as:

    html += '<p>Regards,</p>\n<p>Tom Cruise</p>\n'


    because the concatenated line fits within my max line width.

    I am looking for a the linter setting, not disabling the linter with #fmt: off ... #fmt: on.

    Also note that I cannot add trailing commas to the multi-line string, within the parentheses, which does prevent the behavior in other situations, e.g. lists.

    Continue reading...

Compartilhe esta Página