On Fri, Jun 19, 2015 at 6:45 AM, Birunthan Mohanathas < birunt...@mohanathas.com> wrote:
> Hi, > > Over the past year, I have converted a few directories (xpcom/, > docshell/, embedding/) to Gecko style using a patched Clang-Format and > a few other tools. > > On 17 June 2015 at 18:57, Gregory Szorc <g...@mozilla.com> wrote: > > First thing is first: what are the blockers to mass rewriting > > mozilla-central with clang-format's output? > > Here are a few diffs after running Clang-Format on a few recently > Gecko style-ified directories: > > With my patched Clang-Format: > https://gist.github.com/poiru/d10dfa978f351f20e975 > With upstream Clang-Format: > https://gist.github.com/poiru/c7d1aaf9e83bb653dc37 > > The patched Clang-Format produces reasonably good output, although > there are still a couple of blockers (e.g. BEGIN/END macro indentation > and class base clause indentation). If we want to seriously do this > (and I'm all for it), I can work on getting those blockers fixed and > upstreaming my patches. > > Note that Clang-Format will still produce changes that are not > strictly necessary, but that is mostly a one-time cost and something > we should just live with anyway. Automatic formatting is worth it. > > On 17 June 2015 at 10:07, Gregory Szorc <g...@mozilla.com> wrote: > > If so, perhaps we can find time in Whistler next week to > > better integrate clang-format into the development workflow. I'd be more > > than happy to help. > > +1 for talking about this in Whistler. > > I actually think the workflow integration is a more important issue at > our scale. If developers are to use Clang-Format, we need to ensure > that they all use the same version (as different versions may produce > slightly different output) and that they all remember to run it for > each commit. I introduced Clang-Format at my last workplace and even > with a small team we bumped into both of those issues frequently. > Agreed that workflow is important. We can mass rewrite the tree. But unless the tools to keep things consistent are easy and painless to use, this will add chaos. Some ideas: * We can write commit hooks that will auto format code on local commit. * We can stand up a web service for auto formatting code. * We can track the "blessed" Clang version via an in-tree manifest and have a mechanism for ensuring the local version is up to date (tooltool or some such). * MozReview can reformat automatically during push/review time If someone commits to producing a suitable clang-format binary/config, I'll sign up for creating all the tooling. _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform