January 13, 2016 Re: "Good PR" mechanical check | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Brian Schott | On Wed, Jan 13, 2016 at 07:53:45AM +0000, Brian Schott via Digitalmars-d wrote: > On Wednesday, 13 January 2016 at 05:19:36 UTC, H. S. Teoh wrote: > >There are also some (smaller) examples in std.range, such as in > >transposed(), where nested arrays are formatted like matrices in > >order to make it clear what the function is trying to do. I'm almost > >certain dfmt (or any mechanical formatting tool) will completely ruin > >this. > > It will. There's a solution in the form of special comments: > > // dfmt off > auto treeStructure = [ > node(0, 0), > node(1, 0), > node(2, 0), > node(10, 2), > node(3, 0) > ]; > // dfmt on > > // dfmt off > stuff.map!(a => complicatedFunction(a, 100) * 20) > .filter!(a => a < 2_000 && a %3 == 0) > .sum(); > // dfmt on [...] Fair enough, but will this work in ddoc'd unittests, where you don't necessarily want those dfmt comments to make it into the generated docs? But, case in point, won't UFCS chains be poorly formatted in general? Or are there dfmt comments that can switch dfmt to "UFCS mode"? Or does it detect UFCS chains and format accordingly? T -- To err is human; to forgive is not our policy. -- Samuel Adler | |||
January 13, 2016 Re: "Good PR" mechanical check | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Andrei Alexandrescu | On Wed, Jan 13, 2016 at 08:47:19AM -0500, Andrei Alexandrescu via Digitalmars-d wrote: > On 1/13/16 12:19 AM, H. S. Teoh via Digitalmars-d wrote: > >On Tue, Jan 12, 2016 at 02:03:57PM -0500, Andrei Alexandrescu via Digitalmars-d wrote: > >>On 01/12/2016 08:42 AM, Martin Drašar via Digitalmars-d wrote: > >>>Wouldn't it be sufficient to mandate usage of dfmt with proper settings before submitting a PR? > >> > >>That would suffice at least in the beginning. We also need to put dfmt in tools, again a project that's been in limbo for a long time. -- Andrei > > > >In principle, I agree with mechanical checking of formatting (instead of the endless tedious nitpicking over the fine points of Phobos style), but, as Jonathan has brought up before, there are cases where human judgment is required and a tool would probably make a big mess of things. > > BTW I recall it was your code containing a "switch(x){" that prompted > this idea :o). True story. -- Andrei Haha, was it? I don't recall anymore. :-P T -- Не дорог подарок, дорога любовь. | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply