On Wed, Aug 09, 2017 at 07:19:00PM -0400, Jeff King wrote: > 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. This has been my issue with clang-format in the past. I have an SHA-256 implementation with an array of 64 32-bit hex integers. These fit six to a line, but for neatness and consistency reasons, I'd like them four to a line (4 divides 64, but 6 does not). Last I checked, clang-format didn't allow me that option: it reordered them because it could fit six on a line. This is not the only issue I discovered, just the most memorable. Other tools, such as perltidy, have traditionally honored existing line breaks better (although not perfectly), which lets humans optimize for readability. Of course, clang-format could have dramatically improved since I last looked (which was around clang 3.4 or 3.6, I think). Overall, I do like the idea of using tidy tools, because it does reduce quibbling over style quite a bit. I just like the tools to be more responsive to the whitespace they're given on input. -- brian m. carlson / brian with sandals: Houston, Texas, US https://www.crustytoothpaste.net/~bmc | My opinion only OpenPGP: https://keybase.io/bk2204