Thanks David. I'll try your approach. If there are some things that don't quite work with Clang-Format (I already found a few) I'll see about adding a fixup script pass at the end, or contributing some rules back to Clang.
I'll try your idea about combining all the files under sched into a set. When you said you got 95% of the way there, do you have a .clang-format file that I could use as a starting point? If so that would help me start where you left off. cheers adam On Sun, Mar 8, 2020 at 3:40 AM David Sidrane <david.sidr...@nscdg.com> wrote: > Hi Adam, > > Have a look at https://github.com/mikr/whatstyle > > I got furthest with clang-format and it. It may be we get a 95% of the way > there with it and we can add a backend secondary scripts. > > I was unable to convince Greg to create a master template so my approach > was > to combine all the files and run it on the set so it would get all the > constructs at once. > > David > > -----Original Message----- > From: Adam Feuer [mailto:a...@starcat.io] > Sent: Saturday, March 07, 2020 4:01 PM > To: dev@nuttx.apache.org > Subject: Re: Should we relax precheck a little bit? > > Since there's no current maintainer for nxstyle... What would people think > about trying Clang-Format <http://clang.llvm.org/docs/ClangFormat.html>? > > It's a well-used tool (LLVM, Google, Chromium, Mozilla, Webkit, and > Microsoft <http://clang.llvm.org/docs/ClangFormatStyleOptions.html>), and > can be configured for many different style guides... it should be possible > to configure it for NuttX's style guide. Or at least get close. > > If there's interest, I can take a shot at trying to configure it using the > NuttX style guide. If we went that direction, we'd have another tool to > install. But then we'd only have to maintain a configuration, and we'd be > joining a big community who are all using this same tool. > > What do you think? > > -adam > > On Sat, Mar 7, 2020 at 3:24 PM Gregory Nutt <spudan...@gmail.com> wrote: > > > > > > +1 for fixing nxstyle (or configuring another tool like Clang Format > > > <http://clang.llvm.org/docs/ClangFormat.html>) > > > > > > That would make it a lot easier to submit PRs that are in the right > > format, > > > at least :) > > > > There is no one dedicated to maintaining nxstyle right now. I wrote the > > original*, but there was once a plan for Haitao Liu to take that over. > > Others (YAMT) and been making good contributions. So I would not expect > > any snappy response to nxstyle problems right now. > > > > Greg > > > > * Just a little CYA and history. nsstyle starting out as a tiny hack > > tool that I used to check a few things in files. It got re-used a few > > times and grew and now it is a key program in the workflow. It is > > unfortunate fact that the tool is woefully under designed. Provided > > that we set up some good validation tests, I really think it should be > > redesigned to at least carefully reviewed to make sure that it can > > actually support the things that we expect from it. > > > > It is a dumb tool, it knows nothing about C syntax. I don't think it > > really needs fully understand C syntax, but it does need to understand > > the context of things better. Currently it is just a collection of > > heuristics that spots a few landmarks and makes interfaces from > > comparison of some patterns. So it is not very capable. > > > > > > > > > > -- > Adam Feuer <a...@starcat.io> > -- Adam Feuer <a...@starcat.io>