Closed Arpafaucon closed 4 months ago
How does this work in practice, when you are editing files? Proper code formatting is always a problem and it's good to automate this, but I don't want to be fighting with a system that is "fixing" deliberate side-steps from the established convention, like in the examples you show.
I use VSCode; I don't know how much this applies to other users.
Personnally (and in my company), I hate the "format on save" option of VSCode, because it's acting behind your back.
black
with its strict & deterministic strategy. I like not having to discuss style issues in PR anymore. If you need to deviate from the formatting (typically when entering big arrays of numbers in a matrix-like format) you can always insert comments to locally disable the reformatting. We enforce this in CI, works well in practice, I thinkI have cherry-picked the commit. Formatting is done only on demand, so it's fine.
While working on #825 I found useful to spin up this config file to be able to fit the existing coding style.
It's not perfect, but I already goes a long way; maybe you'd be interested ?
Known caveats:
I committed 2 files so you can quickly look at the diff and get a sense of how files are affected