Automating formatting for official D repos

H. S. Teoh hsteoh at qfbox.info
Wed Jan 24 01:59:47 UTC 2024


On Tue, Jan 23, 2024 at 06:11:00PM -0700, Jonathan M Davis via Digitalmars-d wrote:
> On Tuesday, January 23, 2024 5:49:28 PM MST Meta via Digitalmars-d wrote:
> > On Monday, 22 January 2024 at 23:10:06 UTC, Jonathan M Davis
> >
> > wrote:
> > > Please, no. Code formatters consistently make code look like
> > > garbage. Some flexbility is needed if we want code to actually
> > > look nice.
> > >
> > > - Jonathan M Davis
> >
> > For a large project like this with many contributors, consistency is
> > more important than personal aesthetic preferences.
> 
> My complaint isn't about that. My complaint is that when you have a
> formatter do it, the code always ends up looking ugly no matter the
> rules used, because it's too inflexible about it. We already have a
> style guide (and have had for years), and it's fairly straightforward.
> When a human follows it, there is some flexibility, because the guide
> has some flexibility, and so the human can make intelligent decisions
> about things like line breaks, whereas the formatter is going to be
> dumb about it and apply a much more exact set of rules that then
> result in things like breaking up the code in places which make the
> code harder to read.
[...]

I agree, but there's no reason we can't have both.  If the formatter is
messing things up in a particular bit of code, just wrap it with
`// dfmt off` and `// dfmt on` and format it however you please.


T

-- 
Curiosity kills the cat. Moral: don't be the cat.


More information about the Digitalmars-d mailing list