Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb <gdb@sourceware.org>
To: Joel Brobecker <brobecker@adacore.com>,
	Andrew Burgess <aburgess@redhat.com>
Cc: Luis Machado <luis.machado@arm.com>, Tom Tromey <tom@tromey.com>,
	"Aktemur, Tankut Baris via Gdb" <gdb@sourceware.org>,
	"Aktemur, Tankut Baris" <tankut.baris.aktemur@intel.com>
Subject: Re: automated coding style tool
Date: Fri, 17 Jan 2025 10:55:44 -0500	[thread overview]
Message-ID: <c0a7d72b-1734-4169-a544-ce3fdb5378ba@simark.ca> (raw)
In-Reply-To: <Z4pzhRX/9w9u3eCf@adacore.com>

On 1/17/25 10:13 AM, Joel Brobecker wrote:
>> I don't think adding this tool is going to be the magic bullet everyone
>> seems to think it is.
>>
>> As a reviewer you'll either still need to learn the style in order to
>> spot when a contributor has not running the formatting tool.  Either
>> that, or you need to apply each patch locally and the check run the
>> formatting tool to check the formatting is correct.
> 
> I have experience with a project where developers were asked to install
> a pre-commit check that would run the formatting tool, but where we did
> not have (yet) a pipeline to verify the formatting at submission time.
> This project had a lot of developers, some of them very occasional.
> 
> It's true that, at first, we had a number developers forgot to install
> that pre-commit hook, and ended up submitting ill formatted code.
> 
> What I noticed, at least for myself, is that with time you start
> developing an eye for what the expected formatting is like. And when
> I noticed something odd, I'd just ask if they installed the pre-commit
> and ran the formatting tool. If they say no, I pointed them to
> the directions, and asked them to retest and resubmit. Ultimately,
> we mostly converged.
> 
> And for the cases we didn't notice at review - no big issue.
> The formatting shouldn't be horrible of the reviewer would have
> noticed it, so no great harm -- certainly no worse than right now.
> And later on, the next developer touching the same file ends up
> noticing that the formatting seems wrong. It's a bit of a pain
> for them to first run the formatting tool and push a pure-reformatting
> commit.  But we tell the contributor who forgot, they install the tool,
> and normally we eventually converge.
> 
> Another things we can imagine doing is a nightly job on sourceware
> that runs the nightly snapshot through the formatting tool, and
> sends an email with a list of files that are not conformant.
> 
> Where I think it might be painful is which version of the tool
> to use. Different versions will likely have slightly different
> results in terms of formatting the code. You might want to require
> a specific version and check for that version, to avoid different
> users having different ways of formatting the same code.

I agree with all the above.

We will definitely want to choose a specific version of the tool.  If we
end up using clang-format, that version will likely not be available out
of the box for all distros, but there are other ways to get it.  I don't
know how it works on Windows though, since I don't develop on Windows
much.  We can cross that bridge when we get there.

>> I think if GDB could just move away from the mailing list and each users
>> pushes their own patches model, over to a pull request style approach,
>> then we could potentially have _real_ automated checks, e.g. checking
>> the formatting.  Then we have an _actual_ win.
> 
> Seconded.
> 
> In a model like this, you don't have to ask. You run a job that
> checks it, and you know if it's conformant or not.

I don't agree with Andrew, in that even without a proper pre-merge CI,
you do save time by using a tool to format the code, over doing and
reviewing it manually.

Of course, like Joel said, ill-formatted code will certainly get
committed at some point, but the nightly job will tell us.  It's a quick
fix - one person pushes an obvious patch - and we carry on.  Much less
time overall than pointing out formatting issues one by one (for the
reviewer) and fixing them by hand (for the author).  This is what we do
with our Python code and it works well, I think.

I suppose it would also be possible to write a server-side commit hook
that checks whether the formatting of the affected files is correct, and
reject the push if not.

Simon

  reply	other threads:[~2025-01-17 15:56 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-14 21:52 Contributing to gdb shaunak saha via Gdb
2024-06-17 12:21 ` Guinevere Larsen via Gdb
2024-06-17 15:00   ` DCO: Was: " Andrew Pinski via Gdb
2024-06-17 15:57     ` Guinevere Larsen via Gdb
2024-06-17 16:07       ` Jan Beulich via Gdb
2024-06-17 16:32       ` Eli Zaretskii via Gdb
2024-06-17 16:37         ` Guinevere Larsen via Gdb
2024-06-17 16:45           ` Eli Zaretskii via Gdb
2024-06-17 18:18             ` Guinevere Larsen via Gdb
2024-06-17 18:24               ` Andrew Pinski via Gdb
2024-06-17 19:57                 ` Eli Zaretskii via Gdb
2024-06-17 19:37               ` Eli Zaretskii via Gdb
2024-06-17 19:48                 ` Guinevere Larsen via Gdb
2024-06-18 12:25                   ` Eli Zaretskii via Gdb
2024-06-27 17:48                     ` Thiago Jung Bauermann via Gdb
2024-06-27 19:03                       ` Eli Zaretskii via Gdb
2024-06-29  3:27                         ` Thiago Jung Bauermann via Gdb
2024-06-17 19:15           ` Arsen Arsenović via Gdb
2024-06-18 11:54             ` Eli Zaretskii via Gdb
2024-06-28  0:43               ` NightStrike via Gdb
2024-06-28  6:08                 ` Eli Zaretskii via Gdb
2024-06-21 13:20       ` Nick Clifton via Gdb
2024-06-23 22:06       ` Tom Tromey
2024-12-02  8:56         ` Luis Machado via Gdb
2025-01-13 17:14           ` Andrew Burgess via Gdb
2025-01-13 17:32             ` Eli Zaretskii via Gdb
2025-01-17 10:37               ` Florian Weimer via Gdb
2025-01-17 10:44                 ` Luis Machado via Gdb
2025-01-17 13:01                 ` Eli Zaretskii via Gdb
2025-01-21 19:10                   ` Guinevere Larsen via Gdb
2025-01-13 17:42             ` Simon Marchi via Gdb
2025-01-14 15:17               ` automated coding style tool (was: RE: DCO: Was: Re: Contributing to gdb) Aktemur, Tankut Baris via Gdb
2025-01-14 17:11                 ` automated coding style tool Tom Tromey
2025-01-14 17:14                   ` Luis Machado via Gdb
2025-01-14 17:23                     ` Simon Marchi via Gdb
2025-01-14 23:04                       ` Tom Tromey
2025-01-15  6:03                         ` Maciej W. Rozycki
2025-01-18 18:39                           ` Tom Tromey
2025-01-22 22:36                             ` Maciej W. Rozycki
2025-01-15 10:20                         ` Luis Machado via Gdb
2025-01-15 12:24                           ` Aktemur, Tankut Baris via Gdb
2025-01-17 13:42                           ` Andrew Burgess via Gdb
2025-01-17 15:13                             ` Joel Brobecker via Gdb
2025-01-17 15:55                               ` Simon Marchi via Gdb [this message]
2025-01-17 17:36                                 ` Phi via Gdb
2025-01-17 19:27                                   ` Simon Marchi via Gdb
2025-01-18 18:56                           ` Tom Tromey
2025-01-20 11:30                             ` Luis Machado via Gdb
2025-01-14 17:15                   ` Simon Marchi via Gdb
2025-01-14  9:49             ` DCO: Was: Re: Contributing to gdb Luis Machado via Gdb
2025-01-14 13:56               ` Eli Zaretskii via Gdb
2025-01-14 15:10               ` Simon Marchi via Gdb
2025-01-14 15:28                 ` Luis Machado via Gdb
2025-01-14 15:47                   ` Simon Marchi via Gdb
2025-01-14 16:33                     ` Luis Machado via Gdb
2025-01-14 16:42                     ` Eli Zaretskii via Gdb
2025-01-15 11:49                       ` Mark Wielaard
2025-01-14 16:46               ` Andrew Burgess via Gdb
2025-01-15 11:25                 ` Mark Wielaard
2025-01-15  6:20               ` Maciej W. Rozycki
2025-01-15 11:05               ` Mark Wielaard
2025-01-14 15:28             ` Mark Wielaard
2025-01-17 10:42               ` Florian Weimer via Gdb
2025-01-17 13:09                 ` Eli Zaretskii via Gdb
2025-01-19 16:37                 ` Mark Wielaard
2025-01-27 15:55                 ` DCO Bradley M. Kuhn via Gdb
2025-01-27 16:36                   ` DCO Krzysztof Siewicz via Gdb
2025-01-27 17:22                   ` DCO Guinevere Larsen via Gdb
2025-01-31 19:36                     ` DCO Mark Wielaard
2024-06-18 13:32     ` DCO: Was: Re: Contributing to gdb Michael Matz via Gdb
2024-06-19  7:38   ` shaunak saha via Gdb
2024-06-19 12:07     ` Guinevere Larsen via Gdb
2024-06-25 22:27       ` shaunak saha via Gdb
2024-06-26 17:38 ` Tom Tromey
2024-06-28  7:23   ` shaunak saha via Gdb

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-all 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=c0a7d72b-1734-4169-a544-ce3fdb5378ba@simark.ca \
    --to=gdb@sourceware.org \
    --cc=aburgess@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=luis.machado@arm.com \
    --cc=simark@simark.ca \
    --cc=tankut.baris.aktemur@intel.com \
    --cc=tom@tromey.com \
    /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