The general usage pattern in Go is format-on-save-from-editor, unless it's something like vscode where magic happens.
On Thu, Mar 28, 2019 at 2:03 PM Nico Huber nico.h@gmx.de wrote:
On 16.03.19 18:15, Ron Minnich wrote:
On Sat, Mar 16, 2019 at 9:41 AM Patrick Georgi pgeorgi@google.com wrote: o Huber nico.h@gmx.de schrieb am Sa., 16. März 2019, 16:32:
Do we want to enforce a single editor / IDE + configuration for coreboot contributions?
we don't want to lock out, e.g., sublime, emacs, and vscode users, so no.
yeah, that was just an example, because Vim works for me. And usually the argument for code formatters seems to be that they work for some- body.
Why I brought this IDE point up at all: I played with the idea of a separate tool for formatting in my head and I couldn't come up with anything that would fit into my usual code+commit+push workflow. Maybe that's just because I'm not experienced with such tools. I wonder, at what point it would fit in:
o Between editor and `git add`? o As a pre-commit hook? o As a pre-push hook? o As a hook on Gerrit's side?
I couldn't come up with anything that wouldn't result in more manual work, e.g. to synchronize my local tree with the resulting commits. And well, I guess the point is to save us some work (I don't see where but probably somebody does).
So before we make any final call for a formatting tool, I guess we need a volunteer who says they're going to take the week (or month?) off to integrate it flawlessly (unless I miss here how easy it really is).
Do we want to enforce a single tool, e.g. clang-format, that does the job for us after editing a source file?
If we go for strict coding style adherence requirements that would avoid having to manually review for coding style, which means less talking about it, which in my book is a plus.
Well, I hope it will be a very huge plus. In my book it's at an incredible minus atm: Over the past 7 years of coreboot development, I've spent a lot more time to analyze or work around and discuss our check-patch/check-style hooks than I spent on bikeshedding code format or debating about line lengths.
This is the direction most new projects in modern languages are taking. clang-fmt can do this for older languages like C and I think it makes the most sense.
Most modern languages are parsable, I guess? I haven't tried it yet, but I guess modern languages are much easier to format automatically.
Nico