Open pawamoy opened 1 week ago
My answer there:
You're right, won't be possible if black doesn't allow it. The second and third examples are bothering me in that they don't append trailing commas. I think Black has a setting for that? But even then, formatting once will append the trailing comma, but it would need a second formatting to actually break each param on its own line. I think that's one of the things Ruff does differently, exactly to avoid the need for double-formatting. Anyway I'll see what we can do :)
I'd like to switch to Ruff at some point, but we'll need a Python binding to avoid spawning tons of subprocesses.
As I wrote in the discussion, I wouldn't like trailing commas be added to signatures if they aren't in the source code already. They have a benefit that they make diffs smaller if items are added at the end, but at least less technical users could be confused. Ideally there could be an option to control this behavior, but even then the default should be respecting what's in the source.
Respecting the source will be tough, as we would have to reimplement parts of Griffe to use CSTs instead of ASTs. That's kinda of a goal though, as it would unlock nice use-cases, but it's just tough to achieve, so will need time :slightly_smiling_face:
Reported on Matrix.