From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id VjgSFKPohmCHaAAAWB0awg (envelope-from ) for ; Mon, 26 Apr 2021 12:21:55 -0400 Received: by simark.ca (Postfix, from userid 112) id 475931F11C; Mon, 26 Apr 2021 12:21:55 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 993A31E01F for ; Mon, 26 Apr 2021 12:21:54 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 024DC3838012; Mon, 26 Apr 2021 16:21:54 +0000 (GMT) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id C25673838012 for ; Mon, 26 Apr 2021 16:21:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C25673838012 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wr1-x42e.google.com with SMTP id a4so56533528wrr.2 for ; Mon, 26 Apr 2021 09:21:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=96Sp5xytsrDJgomFXfOhxvmnDqs1nnjehOGjMOfIJcQ=; b=GHlvvNcJUTSimuCRL03gpK7b7Oh1VEP+WxC9TwWN+JCRCFJbeSh+9xjMty1SNchhBe fQgflisvrgu0o7Xo/VV/jelv5Ax7R/4kuhkGXuFVN5mL7iGaijcIANGOP3YkWNoHRPTy uhef0g14nrZuvM/IRG7sMVjh4Nyu5Gn4HeRkic/1kBZtgreRLR0/gLq34DRJZIIlmCef PNRtezKIghwCU96/3t6qTC/17uAgsmE6udMMgG2XoTYS3lY/j8NTswO5qmgO896DNpr2 LfZ2yzMEtQhlqcxHQp4C6OyXOZr9sNloSqtAt9IN0jD8yx5WYf/z2Mj45uI5MJW1Yd3p xa+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=96Sp5xytsrDJgomFXfOhxvmnDqs1nnjehOGjMOfIJcQ=; b=i0q67k9uM3P63e0l7H4eHUv6L+lxhwPYgKtDPHYFUZAhJb/3DRSJprXVyF/xuc3srB y2VrugQv6h1jUFA1pDRR7FfFRFq9UcsvGnGU0+sDQejw/DRoD41fuNnz8pmWrUjlpiYb WY3cf/c+hQM69zI6LJfcoonfZlwkvDcn6Ny/Ql11PgfdMlUb85E6Gl4qWCfqtgHsLTqJ iTvbhwiGbv5QH32HZOscAevI6vk0BpAd4eCodAR5SBxJFPGz7npYLKoWl5yl2+GRBUgA 89WTu7DaGlhKkPDGfITgorUmAAQEI06b5pxpfJPLI6mzy6FtQpQx5yTqBjgLw3/Kbzlw 3oXQ== X-Gm-Message-State: AOAM530gP+A17kcCU1sITyCPVU03P0F3mlxwAdhW9k/rl6ETPdlltEYj TN1gVLGlvLte5To3mKVDlOOcp989BhBxIA== X-Google-Smtp-Source: ABdhPJyFR1fbmqBN1I3T7isqBWYeeWhyj+kvhopMSn1lU1g246q0oksas/QJ8QpBlBmCly+itKQpUw== X-Received: by 2002:adf:ead2:: with SMTP id o18mr24330979wrn.101.1619454110935; Mon, 26 Apr 2021 09:21:50 -0700 (PDT) Received: from localhost (host109-151-46-70.range109-151.btcentralplus.com. [109.151.46.70]) by smtp.gmail.com with ESMTPSA id t206sm18142599wmb.11.2021.04.26.09.21.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 09:21:50 -0700 (PDT) Date: Mon, 26 Apr 2021 17:21:49 +0100 From: Andrew Burgess To: Simon Marchi Subject: Re: Proposal: format GDB Python files with black Message-ID: <20210426162149.GU2610@embecosm.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux/5.8.18-100.fc31.x86_64 (x86_64) X-Uptime: 17:08:07 up 16 days, 2:55, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" * Simon Marchi via Gdb-patches [2021-04-26 11:55:21 -0400]: > 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. > > My suggestion would be to format our code with black all at once. The > typical counter-argument to this is "it will be harder to use > git-blame". I don't think this is true, because you need to be able to > skip over commits anyway, and it's trivial to skip over a commit when > git-blaming using an interactive tool. But it's also possible to tell > git to ignore certain commits when git-blaming [2], so we can do that. > > I think the output of black is quite readable. When it does weird > stuff, it's generally because the lines / expressions are two long > anyway, and deserve to be split in multiple lines / expressions. Here's > a branch that shows how it would look like: In general, the idea of auto-formatting the code sounds great, but I would like to understand more about how the process would work. Right now, if I make a change I edit a file, git add, git commit, and finally, git push. At what point does the auto-formatting take place? Do I need to manually run the tool after editing the file? Is it done, well, automatically at some point? And if it is done automatically, then at what point in the process does this happen, and how does this relate to code review? Thanks, Andrew