public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Paul Koning <paulkoning@comcast.net>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: Proposal: format GDB Python files with black
Date: Mon, 26 Apr 2021 13:44:35 -0400	[thread overview]
Message-ID: <950d8490-da1e-b6f4-fb87-c58548bb57f6@polymtl.ca> (raw)
In-Reply-To: <BB87C904-E040-4D8F-B956-42FED0FD8917@comcast.net>

On 2021-04-26 1:34 p.m., Paul Koning wrote:> 
> 
>> On Apr 26, 2021, at 11:55 AM, Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> wrote:
>>
>> Hi all,
>>
>> A few people I talked to about this and I have good experience with the
>> tool black to auto-format Python code.  It is simple to use, fast and
>> reliable (if it detects that it changed the meaning of the program by
>> mistake, internal-errors out).  I don't think I need to spell out the
>> advantage of using such a tool, but just in case: it removes all the
>> overhead of thinking about formatting when writing or reviewing code.
> 
> In the case of Python, formatting is a core part of writing the code.  Apart from that, I don't see much need for this, what with Emacs editing mechanisms.
> 
> I looked at the sample you mentioned.  It's reasonable enough except for the bizarre way of formatting a long parenthesized condition in an if statement (near the start of FrameDecorator.py).  So while I can't see any reason to use this, it seems ok as a tool that others might use if they like to do so.
> 
> I would object to having this mandatory.

The thing is that it's difficult for some people to use an auto-format
tool if not everybody use it.  You would always get some spurious
formatting changes, so you would need to hand-edit the patch after that
to avoid adding those.  You don't really save time.  What would save me
(and everybody) some cycles is something we could just run mindlessly.

For clang-format, there is git-clang-format that formats just the lines
touched by a commit, perhaps there's something similar with black.  That
sounds like a good idea, but in my experience you just end up with a
weird mix of styles that is even worse, and it still ends up
reformatting more than what you really changed.

Simon

  reply	other threads:[~2021-04-26 17:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-26 15:55 Simon Marchi
2021-04-26 16:21 ` Andrew Burgess
2021-04-26 17:25   ` Simon Marchi
2021-04-26 17:50     ` Andrew Burgess
2021-04-26 18:08       ` Simon Marchi
2021-04-27  7:54         ` Andrew Burgess
2021-04-27 13:21           ` Simon Marchi
2021-04-26 17:42   ` Tom Tromey
2021-04-26 17:34 ` Paul Koning
2021-04-26 17:44   ` Simon Marchi [this message]
2021-04-26 17:48     ` Simon Marchi
2021-04-26 17:39 ` Tom Tromey
2021-04-30 16:26   ` Joel Brobecker
2021-04-26 22:40 ` Lancelot SIX
2021-04-30 17:04   ` Tom Tromey
2021-04-30 17:14     ` Simon Marchi
2021-05-01  6:42       ` Joel Brobecker
2021-04-30 17:21 ` Luis Machado
2021-05-08 16:00 ` Tom Tromey
2021-05-11  2:55   ` Simon Marchi
2021-05-11  2:57     ` Using clang-format Simon Marchi
2021-05-11 13:31       ` Marco Barisione
2021-05-11 13:44         ` Simon Marchi
2021-05-11 20:40       ` Tom Tromey
2021-05-13 17:13         ` Simon Marchi
2021-05-11 11:38     ` Proposal: format GDB Python files with black Luis Machado
2021-05-11 13:49       ` Simon Marchi
2021-05-11 14:23         ` Luis Machado

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=950d8490-da1e-b6f4-fb87-c58548bb57f6@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=paulkoning@comcast.net \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).