cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CODE_STYLE

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 14 Mar 2016 11:08:41 +0100 (CET)

On Mon, 14 Mar 2016, Alex Bligh wrote:

> a) a set of editor settings for the coding style used for vi / emacs /
> whatever

We have a simple .dir-locals.el already, which is a file to allow emacs to
find some basic code style settings. I'm sure it can be improved.

I'd certainly welcome similar setups for other editors, I'm just reluctant to
add settings to every source file as is done in some projects.

> b) a set of parameters for the 'indent' command that makes everything look
> right (my recollection - long time since I hacked on curl source - it's gnu
> indent style, in which case the set of parameters is 'none')

That'd be lovely. Although in my experience, those tools (people tell me
clang-format is the better one of the indenting tools these days) never
completely do what you want and usually mess up some portions of the code no
matter what so you need to go back and hand-edit parts of it. Could still be
helpful of course.

> c) a style checker (as qemu for instance has)

We have one: 'make checksrc'. Although it doesn't detect all mistakes since it
is fairly naive. That can of course also get improved.

> One of the things I learnt a long while ago is that if you have a tool to
> correct formatting, you can avoid any incorrect formatting by refusing
> commits (or even builds) which are not formatted correctly

Yeah, that's indeed a very good thing if you get to that point. It'd remove
frictions and make the process of accepting patches even faster.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:  https://curl.haxx.se/mail/etiquette.html
Received on 2016-03-14