[cfe-dev] [RFC][clang-tidy] indentation readability check

Daniel Marjamäki via cfe-dev cfe-dev at lists.llvm.org
Tue Feb 2 00:00:18 PST 2016


> I would rather see clang- format modified to become acceptable (have it make very few changes given the right options).

I was told that clang-format is not meant to be a general purpose formatter.

And a quick search on the web showed this discussion:

http://lists.llvm.org/pipermail/cfe-dev/2014-September/039097.html

would it be acceptable to add an option for each clang-format refactoring so it can be disabled?

..................................................................................................................
Daniel Marjamäki Senior Engineer
Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

Mobile:                 +46 (0)709 12 42 62
E-mail:                 Daniel.Marjamaki at evidente.se

www.evidente.se

________________________________________
Från: Jonathan Coe [jonathanbcoe at gmail.com]
Skickat: den 29 januari 2016 20:18
Till: Daniel Marjamäki
Kopia: Jonathan Coe; cfe-dev at lists.llvm.org
Ämne: Re: [RFC][clang-tidy] indentation readability check

I would rather see clang- format modified to become acceptable (have it make very few changes given the right options).

I think that people are beginning to make more use of formatters. Having been the one who introduces them to teams, my experience is broadly consistent with yours.

Jon


> On 29 Jan 2016, at 17:58, Daniel Marjamäki <Daniel.Marjamaki at evidente.se> wrote:
>
>
> Hello!
>
>> To my mind this functionality belongs in clang-format rather than clang-tidy.
>
> Yes I should have clarified this.
>
> This check will not complement / undo clang-format. Imho you can use both clang-format and this check, this check will be just redundant then.
>
> It's easy to think that everybody uses a formatter, for instance clang-format, because it's so much better than formatting the code manually.
>
> I work as a contractor and have been to a few companies. I have not seen a company yet that uses a formatting tool, they rather update formatting manually. I have tried to suggest using clang-format or some other such tool.. but there is hard resistance against it.
>
> Best regards,
> Daniel Marjamäki
> ..................................................................................................................
> Daniel Marjamäki Senior Engineer
> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>
> Mobile:                 +46 (0)709 12 42 62
> E-mail:                 Daniel.Marjamaki at evidente.se
>
> www.evidente.se
>
> ________________________________________
> Från: jonathanbcoe at gmail.com [jonathanbcoe at gmail.com] för Jonathan Coe [jbcoe at me.com]
> Skickat: den 29 januari 2016 15:41
> Till: Daniel Marjamäki
> Ämne: Re: [cfe-dev] [RFC][clang-tidy] indentation readability check
>
> To my mind this functionality belongs in clang-format rather than clang-tidy.
>
> What would the check do that clang-format would not undo?
>
> regards,
>
> Jon
>
> On 29 January 2016 at 12:03, Daniel Marjamäki <cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>> wrote:
>
> Hello!
>
> I am working on a new indentation check for clang-tidy.
>
> The idea is to write a generic check that will work no matter if you prefer spaces or tabs or where you like to put { etc. It will just check for some common idioms.
>
> Currently it is designed to warn if there is negative indentation below a if:
>
>    void warn1(int x)
>    {
>          if (x==0)
>       {          // CHECK-MESSAGES: :[[@LINE]]:4: warning: unexpected negative indentation below if [readability-indentation]
>        }
>    }
>
> I am testing this experimental check right now on various projects. So far it has found 129 warnings in 354 debian projects. I've looked at a few warnings and think it looks good overall. I saw no project that consistently use negative indentations below if.
>
> My work-in-progress code can be seen in the attached patches.
>
> I also have seen that there was related work before to create a Windent flag:
> https://llvm.org/bugs/show_bug.cgi?id=18938
>
> Best regards,
> Daniel Marjamäki
>
> ..................................................................................................................
> Daniel Marjamäki Senior Engineer
> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>
> Mobile:                 +46 (0)709 12 42 62<tel:%2B46%20%280%29709%2012%2042%2062>
> E-mail:                 Daniel.Marjamaki at evidente.se<mailto:Daniel.Marjamaki at evidente.se>
>
> www.evidente.se<http://www.evidente.se>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>


More information about the cfe-dev mailing list