Skip to content

Big pack of formatted files that have different output than black #7394

@qarmin

Description

@qarmin

Ruff 0.0.289

Pack of files, which contains differences between black/ruff - https://github.com/qarmin/Automated-Fuzzer/releases/download/test/Broken_Black_Formatting_0_0_289.zip

This files I took directly from pypi packages, without any changes/minimization

I tested 1,500,000 python files and I found 7535 different files, so that means that only 0.5 % formats differently.

This zip file contains 3 type of files - file formatted by black, file formatted by ruff, diff between them

E.g.
12330_black.py

def somar(valor1, valor2):
    resultado = valor1 + valor2
    return (
        "A Soma: "
        "{valor1} + {valor2} = {resultado}"
        "".format(valor1=valor1, valor2=valor2, resultado=resultado)
    )

12330_ruff.py

def somar(valor1, valor2):
    resultado = valor1 + valor2
    return "A Soma: " "{valor1} + {valor2} = {resultado}" "".format(
        valor1=valor1, valor2=valor2, resultado=resultado
    )

12330_diff.py

--- /home/rafal/test/DOWNLOADED/broken_files/12330_black.py	2023-09-14 21:57:26.352892470 +0200
+++ /home/rafal/test/DOWNLOADED/broken_files/12330_ruff.py	2023-09-14 21:57:33.788715213 +0200
@@ -1,7 +1,5 @@
 def somar(valor1, valor2):
     resultado = valor1 + valor2
-    return (
-        "A Soma: "
-        "{valor1} + {valor2} = {resultado}"
-        "".format(valor1=valor1, valor2=valor2, resultado=resultado)
+    return "A Soma: " "{valor1} + {valor2} = {resultado}" "".format(
+        valor1=valor1, valor2=valor2, resultado=resultado
     )

I compared ruff format . with black ..
Is there a way to remove automatically known incompatibilities?

To find differences, first I formatted file with ruff, next I formatted them with black and from output I took list of files that were formatted second them to report them here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    formatterRelated to the formatter

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions