[Mesa-dev] [RFC] Coding style scripts (Was Re: [PATCH 1/2] gallium: replace [0-9]*.f with [0-9]*.0f)
jfonseca at vmware.com
Mon Jun 27 10:52:49 UTC 2016
On 22/06/16 13:25, Emil Velikov wrote:
> Hi All,
> Seems like we have a few people are keen on the idea of having some
> form of at least semi-automated way to handle coding style issues.
> Some options/ideas:
> - Combine the emacs .dir-local.el + emacs -batch to do the checking:
> Pros: rules aren't duplicated in multiple places (like the second
> option). Cons: not everyone has emacs
> - or, check-in a few (as needed) xa-indent style scripts based on indent.
> Pros: indent seems (imho) more widely spread. Cons: the style rules
> are duplicated.
> IMHO we don't have to 'enforce' one or the other throughout the tree.
> Having either one would be beneficial, but definitely not a
> Once we're happy with that, we could have a simple toplevel
> "check-all-style" script, which can be used by both developers and git
> hooks. And with time patchwork/other solution will be able to
> pre-emptively run these and provide feedback, at which time we'll
> toggle the git hooks to reject 'non-compliant' pushes (or even before
> the pw stuff is in place) ?
> There's a couple small catches
> - I cannot convince emacs to honour .dir-locals.el in batch mode. Any takers ?
> - We might have a couple of initial "x: unify coding style" commits.
> Rob, seems like most (all?) of your mode lines in freedreno are busted
> (missing : after tab-width, typo(s) in tab-width). Considering there's
> a fdno .dir-locals.el are you ok with just nuking them all together ?
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
I like the idea of using automated checks to check style, and maybe in
the future do even more things like check for common errors (e.g.,
particularly portability issues that are not caught by any compiler
warning, using unsafe functions, etc)
But using Emacs seems at odds with not enforcing. Not enforcing means
it must be easy for developers to runs the checks/formatters. So a more
lightweight dependency would be better.
BTW, I've been using http://editorconfig.org/ on several projects. It's
widely supported by many editors including Emacs.
There's even Python based tools to check editorconfig (
). We already require Python, downloading a Python package is trivial
to do nowadays with pip, so we could easily standardize on .editorconfig
Another solution could be http://clang.llvm.org/extra/clang-tidy/ . I
read it can handle C too. And this could be a tool we could use beyond
More information about the mesa-dev