DFTK.jl icon indicating copy to clipboard operation
DFTK.jl copied to clipboard

Automatic source-code formatting

Open mfherbst opened this issue 5 years ago • 3 comments
trafficstars

Now that JuliaFormatter is around and reasonably stable, we could easily set something up and integrate it with our workflows using a git pre-commit hook.

mfherbst avatar Dec 12 '19 13:12 mfherbst

Not sure about running it automatically (might be a lot of hassle, and I don't trust it to be always right), but something that we run every once in a while (and check it's sensible), sure.

antoine-levitt avatar Dec 12 '19 17:12 antoine-levitt

I use some nice plugins for python and C++ to format my source code on each write. If you get use to it it's just great. You type your code and don't care about the formatting, write and boom it looks nice. If you don't like it, you can always disable it for a region. Happens rarely, however in my experience. Also this really helps to visually detect programming errors (because the formatting looks off). Trust me, once you have this setup and got used to it, you do not want to miss it.

mfherbst avatar Dec 12 '19 17:12 mfherbst

Yeah I have emacs doing a bunch of auto stuff also. But then its rules are going to be different from those of that formatter, and it's going to be super annoying. Plus sometimes I do know better than the automatic rule and I want to overwrite that. So let's keep it manual and run it every few months or so.

antoine-levitt avatar Dec 12 '19 18:12 antoine-levitt