Web lists-archives.com

Re: [RFC] clang-format: outline the git project's coding style

On Wed, Aug 09, 2017 at 03:53:17PM -0700, Stefan Beller wrote:

> >> Right, the reason I stopped pursuing it was that I couldn't find a way
> >> to have it make suggestions for new code without nagging about existing
> >> code. If we were to aggressively reformat to match the tool for existing
> >> code, that would help. But I'm a bit worried that there would always be
> >> suggestions from the tool that we don't agree with (i.e., where the
> >> guiding principle is "do what is readable").
> We may have different opinions on what is readable/beautiful code.
> If we were to follow a mutual agreed style that is produced by a tool,
> we could use clean/smudge filters with different settings each.

I'm less worried about a difference of opinion between humans. My
concern is that there are cases that the tool's formatting makes _worse_
than what any human would write. And either we accept ugly code because
the tool sucks, or we spend a bunch of time fighting with the tool to
try to make its output look good.

> > I would think based on these options, a pre commit hook can be
> > written that formats precisely the touched lines of code of each file.
> I did not search enough, "clang-tidy-diff.py --fix" should be all that is needed

I think I found that script when we discussed this a while back, but I
couldn't get it to stop bugging me about lines that I hadn't touched.  I
haven't looked at it recently, though.  That's specifically what I was
wondering about with "is the tooling ready for this".