You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Leif Hedstrom <zw...@apache.org> on 2013/06/15 02:14:12 UTC
Clang for format/indentation...
Hi all,
I learned about the clang formatting tool today:
http://clang.llvm.org/docs/ClangFormat.html
I'm thinking we should run all our source through this just before the
last 3.3.x release. We would of course have to create a config file
suitable for our formatting standards. Once done, we could have
Jenkins/CI run this on all commits, and show diffs where new code is not
following the standards (or even more draconian, enforce it).
There are also some nice vim and emacs bindings to use this, e.g.
(load "<path-to-clang>/tools/clang-format/clang-format.el")
(global-set-key [C-M-tab] 'clang-format-region)
For our current standards, see
https://cwiki.apache.org/confluence/display/TS/Coding+Style
Thoughts?
-- leif
Re: Clang for format/indentation...
Posted by Igor Galić <i....@brainsware.org>.
----- Original Message -----
> I has some configs, 3-4 styles and 15 or so config options.
right now this is breaking a lot of lines in places where we
previously either didn't care, or actually made sure they were
unbroken -- perhaps we should teach clang-format that our
tolerance is slightly higher than that.
It's also changing one of the most distinct features of our code:
-static void*
-check(void *arg)
-{
+static void *check(void *arg) {
> -- Leif
>
> Sent from my C64
>
> On Jun 16, 2013, at 7:11 AM, Igor Galić <i....@brainsware.org>
> wrote:
>
> >
> > Last time I checked this wasn't really configurable. is it now?
> >
> > ----- Original Message -----
> >> On Jun 15, 2013, at 6:23 AM, Phil Sorber <so...@apache.org>
> >> wrote:
> >>
> >>> +1. Would also make it easier to convert to your preferred format
> >>> locally
> >>> via git hooks or some other, then convert back for commit.
> >>
> >> Yep, that's how this got brought up, someone was doing exactly
> >> this.
> >> I don't know if we can get git hooks, but Daniel probably knows :)
> >>
> >> -- Leif
> >
> > --
> > Igor Galić
> >
> > Tel: +43 (0) 664 886 22 883
> > Mail: i.galic@brainsware.org
> > URL: http://brainsware.org/
> > GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE
> >
>
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE
Re: Clang for format/indentation...
Posted by Leif Hedstrom <zw...@apache.org>.
I has some configs, 3-4 styles and 15 or so config options.
-- Leif
Sent from my C64
On Jun 16, 2013, at 7:11 AM, Igor Galić <i....@brainsware.org> wrote:
>
> Last time I checked this wasn't really configurable. is it now?
>
> ----- Original Message -----
>> On Jun 15, 2013, at 6:23 AM, Phil Sorber <so...@apache.org> wrote:
>>
>>> +1. Would also make it easier to convert to your preferred format
>>> locally
>>> via git hooks or some other, then convert back for commit.
>>
>> Yep, that's how this got brought up, someone was doing exactly this.
>> I don't know if we can get git hooks, but Daniel probably knows :)
>>
>> -- Leif
>
> --
> Igor Galić
>
> Tel: +43 (0) 664 886 22 883
> Mail: i.galic@brainsware.org
> URL: http://brainsware.org/
> GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE
>
Re: Clang for format/indentation...
Posted by Igor Galić <i....@brainsware.org>.
Last time I checked this wasn't really configurable. is it now?
----- Original Message -----
> On Jun 15, 2013, at 6:23 AM, Phil Sorber <so...@apache.org> wrote:
>
> > +1. Would also make it easier to convert to your preferred format
> > locally
> > via git hooks or some other, then convert back for commit.
>
> Yep, that's how this got brought up, someone was doing exactly this.
> I don't know if we can get git hooks, but Daniel probably knows :)
>
> -- Leif
>
--
Igor Galić
Tel: +43 (0) 664 886 22 883
Mail: i.galic@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515 2EA5 4B1D 9E08 A097 C9AE
Re: Clang for format/indentation...
Posted by Leif Hedstrom <zw...@apache.org>.
On Jun 15, 2013, at 6:23 AM, Phil Sorber <so...@apache.org> wrote:
> +1. Would also make it easier to convert to your preferred format locally
> via git hooks or some other, then convert back for commit.
Yep, that's how this got brought up, someone was doing exactly this. I don't know if we can get git hooks, but Daniel probably knows :)
-- Leif
Re: Clang for format/indentation...
Posted by Phil Sorber <so...@apache.org>.
+1. Would also make it easier to convert to your preferred format locally
via git hooks or some other, then convert back for commit.
On Sat, Jun 15, 2013 at 7:23 AM, Phil Sorber <ph...@sorber.net> wrote:
> +1. Would also make it easier to convert to your preferred format locally
> via git hooks or some other, then convert back for commit.
>
>
> On Fri, Jun 14, 2013 at 6:14 PM, Leif Hedstrom <zw...@apache.org> wrote:
>
>> Hi all,
>>
>> I learned about the clang formatting tool today:
>>
>> http://clang.llvm.org/docs/**ClangFormat.html<http://clang.llvm.org/docs/ClangFormat.html>
>>
>>
>> I'm thinking we should run all our source through this just before the
>> last 3.3.x release. We would of course have to create a config file
>> suitable for our formatting standards. Once done, we could have Jenkins/CI
>> run this on all commits, and show diffs where new code is not following the
>> standards (or even more draconian, enforce it).
>>
>> There are also some nice vim and emacs bindings to use this, e.g.
>>
>> (load "<path-to-clang>/tools/clang-**format/clang-format.el")
>> (global-set-key [C-M-tab] 'clang-format-region)
>>
>>
>> For our current standards, see
>>
>> https://cwiki.apache.org/**confluence/display/TS/Coding+**Style<https://cwiki.apache.org/confluence/display/TS/Coding+Style>
>>
>>
>> Thoughts?
>>
>> -- leif
>>
>>
>