Is anyone working on a D source code formatting tool?

Joakim via Digitalmars-d digitalmars-d at puremagic.com
Sat Jan 10 21:17:28 PST 2015


On Saturday, 10 January 2015 at 22:11:55 UTC, Walter Bright wrote:
> On 1/10/2015 12:17 PM, Walter Bright wrote:
>> Has someone made a dfmt, like http://gofmt.com/ ?
>
> Next question - standalone tool, or built in to dmd (like Ddoc)?
>
> BTW, I think dfmt would be a significant win for D:
>
> 1. people expect this sort of thing these days
> 2. it tends to end bikeshedding arguments about the right way 
> to format things
> 3. it'll help standardize the format of D code in the D 
> repositories
> 4. it's simply nice and convenient!
> 5. it's a great first step when you're faced with fixing 
> someone else's crap code
>
> I don't think it'll be hard to do as a builtin feature of dmd.
>
> My only concern about it is if dfmt is changed, then we get 
> faced with a blizzard of changes in the D github repositories.

I agree that there should be a tool like this for D, don't care 
if it's stand-alone or part of dmd.

In my experience submitting PRs on github, 2. and 3. would 
definitely be alleviated by dfmt, as there's sometimes review 
comments about formatting and they'd go away if you just told all 
contributors to run dfmt first, to get the patches in a standard 
format.

As for your concern about github formatting commits, inevitable 
cost of standardizing and then changing your mind.


More information about the Digitalmars-d mailing list