Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNHea-00AgNm-L1 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jan 2024 19:20:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rNHeY-00F8dT-DM for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Jan 2024 19:20:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rNHeY-00F8dK-1U for pgsql-hackers@lists.postgresql.org; Tue, 09 Jan 2024 19:20:46 +0000 Received: from mail-oi1-x234.google.com ([2607:f8b0:4864:20::234]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rNHeT-000hPg-NW for pgsql-hackers@lists.postgresql.org; Tue, 09 Jan 2024 19:20:45 +0000 Received: by mail-oi1-x234.google.com with SMTP id 5614622812f47-3bbc649c275so1962675b6e.0 for ; Tue, 09 Jan 2024 11:20:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neon.tech; s=google; t=1704828039; x=1705432839; darn=lists.postgresql.org; h=in-reply-to:references:to:subject:cc:from:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ta/gB3MQSXJbb/YAB4SIH/aPiPhZ/lqFhQrEXE99p+s=; b=beCkbe7NPjMiPPwUCnoa45jiPfg0wReKyVMmR2O1euV9ceIYRpmuFp9ANjw1q1M+5X wzc9nCfBzPy+/SUH7JCv0cG1nDbgB9Q1lJamwT/XYQlXvLPt6okJV68v4r+C28oBlYnD xE2BZPgSzkKrsXJVDsoF9MSgRIspF7DD9Z184= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704828039; x=1705432839; h=in-reply-to:references:to:subject:cc:from:message-id:date :content-transfer-encoding:mime-version:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Ta/gB3MQSXJbb/YAB4SIH/aPiPhZ/lqFhQrEXE99p+s=; b=BvCuOHmc2Mh+njr0XnqHwEF7dGZT3k+5AhT+Jbu8RTi1SL6HuCQBFYRJfaXqk8qt2z Ef/Ig68gv6o+r5mpjrltB/BT3zIVQAwiZImVG/qtIHTtJ5OpHnr8M5ygzbnW0Ps9xFDZ VOqQqELxlp+cluQsYO+Rj5fwg4iw2mfWUq1fipan1p7c/4YuwuqQT9KLhJN3vE2+3DB2 +UwINApb0xgtVoAsTXnJEZc3xyeRnV2EYZtJZdP4TYzZ1nmOsrar4Pt3fCqXZ3zW0wv5 SB+HKxNtsnwDueJSMFBn9s6pBBiv9BHbu8TXyk5OcAUc0K4VYM3XMQPW03LpdqUlv6Nq KQYg== X-Gm-Message-State: AOJu0YxhWXHP2GLXqAjEmD+ydBJdBz0ds6TVd6n0B3af5ne3tZDqX/T3 3gk4WxXN8TSWSTSntQHgnaCUrGXOnch88Q== X-Google-Smtp-Source: AGHT+IFMCBqy5MzZaKsCZfhvYm6lUMUT2w75S2iu9o8n977Ne8s1sM8sgyJu00JQx1vhawNlXB2q1A== X-Received: by 2002:a05:6808:3094:b0:3bd:2352:3efc with SMTP id bl20-20020a056808309400b003bd23523efcmr3477455oib.35.1704828038928; Tue, 09 Jan 2024 11:20:38 -0800 (PST) Received: from localhost ([2607:fb90:e683:8cf6:3996:e070:71ee:42fb]) by smtp.gmail.com with ESMTPSA id 4-20020aca1104000000b003bc3a42de83sm439323oir.16.2024.01.09.11.20.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 09 Jan 2024 11:20:38 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed Date: Tue, 09 Jan 2024 13:20:37 -0600 Message-Id: From: "Tristan Partin" Cc: "PostgreSQL Hackers" Subject: Re: Add BF member koel-like indentation checks to SanityCheck CI To: "John Naylor" , "Bharath Rupireddy" , "Jelte Fennema-Nio" X-Mailer: aerc 0.16.0-127-gec0f4a50cf77 References: In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue Jan 9, 2024 at 3:00 AM CST, John Naylor wrote: > On Mon, Oct 30, 2023 at 2:21=E2=80=AFPM Bharath Rupireddy > wrote: > > > > Hi, > > > > How about adding code indent checks (like what BF member koel has) to > > the SanityCheck CI task? This helps catch indentation problems way > > before things are committed so that developers can find them out in > > their respective CI runs and lets developers learn the postgres code > > indentation stuff. It also saves committers time - git log | grep > > 'koel' | wc -l gives me 11 commits and git log | grep 'indentation' | > > wc -l gives me 97. Most, if not all of these commits went into fixing > > code indentation problems that could have been reported a bit early > > and fixed by developers/patch authors themselves. > > > > Thoughts? > > There are three possible avenues here: > > 1) Accept that there are going to be wrong indents committed sometimes > 2) Write off buildfarm member koel as an experiment, remove it, and do > reindents periodically. After having been "trained", committers will > still make an effort to indent, and failure to do so won't be a > house-on-fire situation. > 3) The current proposal > > Number three is the least attractive option -- it makes everyone's > development more demanding, with more CI failures where it's not > helpful. If almost everything shows red in CI, that's too much noise, > and a red sanity check will just start to be ignored. You can't ignore something that has to be required. We could tell=20 committers that they shouldn't commit patches that don't pass pgindent,=20 which might even be the current case; I'm not sure. > I don't indent during most of development, and don't intend to start. Could you expand on why you don't? I could understand as you're writing,=20 but I would think formatting on save, might be useful. > Inexperienced developers will think they have to jump through more > hoops in order to get acceptance, making submissions more difficult, > with no corresponding upside for them. The modern developer is well accustomed to code formatting/linting=20 requirements. Languages that attract the average developer like Rust,=20 Python, and JavaScript all have well-known tools that many projects use=20 like rustfmt, black, or prettier. > Also, imagine a CF manager sending 100 emails complaining about indentati= on. > So, -1 from me. Yes, this would be annoying for a CF manager, and for that reason,=20 I would agree with your assessment. But I think this issue speaks more=20 to how tooling around Postgres hacking works in general. For instance,=20 if we look at something like SourceHut, they send emails from their CI=20 to the patchset it tested, which gives submitters pretty immediate=20 feedback about whether their patch meets all the contributing=20 requirements. See the aerc-devel mailing list for an example[1]. I don't want to diminish the thankless work that goes into maintaining=20 the current tooling however. These aren't easy problems to solve, and=20 I know most people would rather hack on Postgres than cfbot, etc. Thanks=20 for keeping the Postgres lights on! I think the current proposal is good if the development experience=20 around pgindent was better. I've tried to help with this. I created=20 a VSCode extension[0], which developers can use to auto-format Postgres=20 and extension source code if set up properly. My next plan is to=20 integrate pgindent into a Neovim workflow for myself, that I can maybe=20 package into a plugin for others. I'd also like to get to the suggestion=20 that Jelte sent about adding pgindent checks to check-world. In Meson,=20 I will add a run_target() for it too. If we can lower the burden of=20 running pgindent, the more chances that people will actually use it! Projects of similarly large scope like LLVM manage to gate pull requests=20 on code formatting requirements, so it is definitely in the realm of=20 possibility. Unfortunately for Postgres, we are fighting an uphill=20 battle where life isn't as simple as opening a PR and GitHub Actions=20 tells you pretty quickly if your code isn't formatted properly. We don't=20 even run CI on all patches that get submitted to the list. They have to=20 be added to the commitfests. I know part of this is to save resources,=20 but maybe we could start manually running CI on patches on the list by=20 CCing cfbot or something. Just an idea. Perhaps the hardest thing to change is the culture of Postgres=20 development. If we can't all agree that we want formatted code, then=20 there is no point in anything that I discussed. [0]: https://marketplace.visualstudio.com/items?itemName=3Dtristan957.postg= res-hacker [1]: https://lists.sr.ht/~rjarry/aerc-devel/patches/48415 --=20 Tristan Partin Neon (https://neon.tech)