[Mesa-dev] [PATCH mesa] Introduce .editorconfig
Eric Engestrom
eric.engestrom at imgtec.com
Tue Aug 30 12:43:03 UTC 2016
On Mon, Aug 29, 2016 at 11:43:49PM +0200, Serge Martin wrote:
> On Monday 29 August 2016 22:30:58 Eric Engestrom wrote:
> > A few weeks ago, Jose Fonseca suggested [0] we use .editorconfig files
> > to try and enforce the formatting of the code, to which Michel Dänzer
> > suggested [1] we start by importing the existing .dir-locals.el
> > settings. The first draft was discussed in the RFC [2].
> >
> > These .editorconfig are a first step, one that has the advantage of
> > requiring little to no intervention from the devs once the settings
> > files are in place, but the settings are very limited. This does have
> > the advantage of applying while the code is being written.
> > This doesn't replace the need for more comprehensive formatting tools
> > such as clang-format & clang-tidy, but those reformat the code after
> > the fact.
> >
> > [0] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121545.html
> > [1] https://lists.freedesktop.org/archives/mesa-dev/2016-June/121639.html
> > [2] https://lists.freedesktop.org/archives/mesa-dev/2016-July/123431.html
> >
> > Reviewed-by: Eric Anholt <eric at anholt.net> (for vc4)
> > Acked-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> > Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> > ---
> >
> > First off, sorry I took so long to follow up on this.
> > Here's the v1 with most of the changes suggested in the RFC/v0, except for
> > the couple following issues:
> >
> > Jose thinks I should remove this line:
> > > +trim_trailing_whitespace = true
> >
> > His reasoning is:
> > > I'm sure we have lots of files with trailing whitespace, and this means
> > > that people doing trivial one liner fixes might suddently cause the whole
> > > file to be munged and stripped.
> > >
> > > So I think we should remove this from the top level editorconfig. It's
> > > fine to have it on specific subdirs, which are know to be
> > > trailing-whitespace free.
> > I don't think waiting for the rule to be followed before introducing it can
> > work, but I do understand that introducing it like this might result in
> > people sending a lot of whitespace changes in unrelated patches.
> > One solution I would prefer is to have a cleanup patch (in the same series)
> > that removes those trailing spaces, making the rule enforceable right away.
> > What do you guys think?
> >
> > A couple of people have also suggested I add `tab_width`, but IMO this
> > concept should die: it comes from the confusion between indentation (a
> > logic concept meant to convey code structure) and alignment (an aesthetic
> > concept). If you need a specific size for your tabs, you're not indenting,
> > you're aligning, which makes no sense to do with a character that will have
> > a varying size in the first place.
> > There is a (pointless IMO, who cares?) war between tab and space indentation
> > with various arguments on each side, but I have yet to find anyone with a
> > single argument in favour of using varying-width characters to align
> > code... yet I keep seeing people doing it.
> > (OK, that's not true: I do have a preference for space indentation, because
> > it makes it harder for people to do the wrong thing when they get confused)
> > </rant> (sorry)
> > ---
> > .editorconfig | 35
> > ++++++++++++++++++++++++ bin/.editorconfig |
> > 3 ++
> > include/CL/.editorconfig | 3 ++
>
> I'm not sure we need an editorconfig in this dir.
> The headers are a copy of Khronos ones
I just checked the history of that dir and you're right, the only
changes are updates from Khronos.
I'll remove it in a v2 tonight.
Cheers,
Eric
More information about the mesa-dev
mailing list