[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=OrAzUb0+c0jkR1OLCcjXh+QnrCHhk39+p3Fv2unBxjQ@mail.gmail.com>
Date: Thu, 12 Sep 2019 15:58:16 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Joe Perches <joe@...ches.com>, Jeff Moyer <jmoyer@...hat.com>,
Dan Williams <dan.j.williams@...el.com>,
linux-nvdimm <linux-nvdimm@...ts.01.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [PATCH 00/13] nvdimm: Use more common kernel coding style
On Thu, Sep 12, 2019 at 2:58 PM Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> On Thu, Sep 12, 2019 at 11:08 PM Joe Perches <joe@...ches.com> wrote:
> >
> > Please name the major projects and then point to their
> > .clang-format equivalents.
> >
> > Also note the size/scope/complexity of the major projects.
>
> Mozilla, WebKit, LLVM and Microsoft. They have their style distributed
> with the official clang-format, not sure if they enforce it.
>
> Same for Chromium/Chrome, but it looks like they indeed enforce it:
>
> "A checkout should give you clang-format to automatically format C++
> code. By policy, Clang's formatting of code should always be accepted
> in code reviews."
>
> I would bet other Google projects do so as well (since Chandler
> Carruth has been giving talks about clang-format for 7+ years). Nick?
So Google3 (the internal monorepo that Android, Chromium, ChromiumOS,
Fuchsia are not a part of) is pretty sweet. You cannot even post code
unless the linter has been run on it (presubmit hook), which for our
~350 millions LoC of C++ is clang-format. If you bypass local
presubmit hooks, our code review tool ("critique") won't let you
submit code that fails lint presubmit checks. I suspect the initial
conversion was probably committed by bots.
>
> I hope those are major enough. There is also precedent in other
> languages (e.g. Java, C#, Rust).
Yep! Other people coming to C/C++ from these languages find the
discussion about tabs vs spaces to be highly entertaining! When you
have an automated code formatter and an agreed upon coding style (and
hopefully enforcement), you save so much time from avoided bikesheds!
Don't like the codebase's coding style? Then write the code how you
like and just run the formatter when you're done (might not help with
conventions though, maybe that's where checkpatch.pl can shine).
Done! No more wasted time on what color to paint the bikeshed!
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists