public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pedro Falcato" <pedro.falcato@gmail.com>
To: Laszlo Ersek <lersek@redhat.com>
Cc: devel@edk2.groups.io, Rebecca Cran <rebecca@bsdio.com>,
	mikuback@linux.microsoft.com,
	 Michael Kinney <michael.d.kinney@intel.com>,
	Andrew Fish <afish@apple.com>,
	 Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>,
	 "Leif Lindholm (Quic)" <quic_llindhol@quicinc.com>
Subject: Re: [edk2-devel] edk2 uncrustify update (73.0.8)?
Date: Thu, 23 Nov 2023 01:44:09 +0000	[thread overview]
Message-ID: <CAKbZUD1-Dm4xBwxpOsTE_m801sQH4pm=c7gFksJGry0y-M84fg@mail.gmail.com> (raw)
In-Reply-To: <59767c3d-f79a-15fc-b498-3aa829ce3450@redhat.com>

On Fri, Nov 17, 2023 at 9:08 AM Laszlo Ersek <lersek@redhat.com> wrote:
>
> On 11/16/23 09:29, Pedro Falcato wrote:
> > On Tue, Nov 14, 2023 at 3:01 PM Laszlo Ersek <lersek@redhat.com> wrote:
> >>
> >> On 11/13/23 22:33, Pedro Falcato wrote:
> >>> On Mon, Nov 13, 2023 at 8:37 PM Rebecca Cran <rebecca@bsdio.com> wrote:
> >>>>
> >>>> On 11/13/2023 1:08 PM, Michael Kubacki wrote:
> >>>>> Yes. I just did it. It is relatively minor and impacts expected code
> >>>>> areas.
> >>>>>
> >>>>> https://github.com/tianocore/edk2/pull/5043/files
> >>>>
> >>>>
> >>>> Could you update .git-blame-ignore-revs please?
> >>>
> >>> You can't do that until the merge is done, since we use
> >>> rebase-and-merge for tianocore (and rebases do not keep stable commit
> >>> hashes).
> >>> But I would plead that this should not get merged in general :/
> >>
> >
> > Laszlo!
> >
> > Sorry for the delay.
> >
> >> Seeing the cumulative diff in that PR, do you have specific
> >> counter-arguments?
> >
> > Well, my counter-argument is that formatting is becoming a topic of
> > its own. I used to be very pro-formatter but if this leads to either
> > 1) eyesore or 2) weird churn every now and then,
> > I feel like we should reconsider the current approach. I feel like all
> > formatting (manual or automated) is fine as long as it's:
> > 1) Visually consistent with the codebase's style
> > 2) Not horrendous to look at
>
> That was what we did first, for several years. It wasn't working well.
>
> An edk2 coding style document had always existed, but it had sufficient
> corner cases that formatting had *always* been a topic of its own. In
> particular, point (2) "not horrendous to look at" is impossible to define.
>
> - edk2 mainly uses a Windows-like coding style, which is immediately
> horrendous to anyone coming from a Linux background, at first

FWIW, this is a point so annoying that normal formatting tools don't
work. It makes you need a fork of an obscure formatter (I know 1
project that uses uncrustify - EDK2...), instead of something more
conventional such as clang-format.
And, FWIW, I've seen a couple of approximations of the NT kernel style
for clang-format.

>
> - edk2 uses extremely long lines in some modules (200+ characters). I
> personally use 80 character lines (for good reason -- not the greatest
> eyesight, so I need to use a relatively large font, and I like to place
> two columns of source code on my screen side-by-side, for diffing or
> comparing otherwise). I've received multiple "buy a larger monitor" or
> "use two monitors at the same time", and those don't work for me either.
> Some people are super productive with 30" monitors, I'm not. Therefore,
> "long lines or not" can never be decided by democracy, only by decree.
> uncrustify is decree.
>
> - somewhat as a consequence of my avoidance of long lines, I tended to
> break up long function calls earlier / more frequently than other
> developers. In order to conserve *vertical* screen real estate, I used a
> "condensed" multi-line argument style for function calls, in OvmfPkg and
> ArmVirtPkg. (The official multi-line style is more wasteful.) That
> wasn't working for other project participants. Uncrustify now does not
> permit my preferred (condensed) style, but at least there are no more
> debates about it.
>
> Your premise is that those two points form a stable foundation, but they
> don't. We tried.

I may be too naive, but with a *well defined* coding style and a
formatter to *help*, I don't see how things would end up poorly.
I think a formatter's job should be to *aid*, to not enforce. These
things are fallible. For instance, clang-format eyesore out of one of
my personal projects:

#define ONES ((size_t) -1 / UCHAR_MAX)
#define HIGHS (ONES * (UCHAR_MAX / 2 + 1))
#define HASZERO(x) (((x) -ONES) & ~(x) &HIGHS)

(may be hard to see in email, but note how clang-format has no idea
how any macro works, so (x) - ONES becomes (x) -ONES and <expr> &
HIGHS becomes <expr> &HIGHS...)

For instance, I think Linux manages this quite nicely. They provide a
.clang-format you can use, and the formatting generally ends up fine.
But you're not expected to re-format every couple of changes, not
everyone is at the same formatter version (if at all!) and "human
thinks looks fine" has higher priority over "*formatter* thinks it
looks fine".

-- 
Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111639): https://edk2.groups.io/g/devel/message/111639
Mute This Topic: https://groups.io/mt/102559740/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-11-23  1:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-13 11:58 [edk2-devel] edk2 uncrustify update (73.0.8)? Laszlo Ersek
2023-11-13 12:29 ` Marcin Juszkiewicz
2023-11-13 19:14   ` Rebecca Cran via groups.io
2023-11-13 20:37     ` Michael Kubacki
2023-11-13 19:07 ` Pedro Falcato
2023-11-13 20:21   ` Michael Kubacki
2023-11-13 21:05     ` Michael D Kinney
2023-11-14 14:51   ` Laszlo Ersek
2023-11-14 15:12     ` Rebecca Cran via groups.io
2023-11-15  8:52       ` Laszlo Ersek
     [not found] ` <17974449E158DE38.1153@groups.io>
2023-11-13 19:10   ` Pedro Falcato
2023-11-13 20:08 ` Michael Kubacki
2023-11-13 20:37   ` Rebecca Cran
2023-11-13 21:33     ` Pedro Falcato
2023-11-14 15:01       ` Laszlo Ersek
2023-11-16  8:29         ` Pedro Falcato
2023-11-16 17:36           ` Michael Kubacki
2023-11-23  2:07             ` Pedro Falcato
2023-11-17  9:08           ` Laszlo Ersek
2023-11-23  1:44             ` Pedro Falcato [this message]
2023-11-14  1:46     ` Michael Kubacki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAKbZUD1-Dm4xBwxpOsTE_m801sQH4pm=c7gFksJGry0y-M84fg@mail.gmail.com' \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox