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 1rFGox-0097gM-Qm for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Dec 2023 16:50:23 +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 1rFGow-00B5f5-BQ for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Dec 2023 16:50:22 +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 1rFGow-00B5ew-0h for pgsql-hackers@lists.postgresql.org; Mon, 18 Dec 2023 16:50:22 +0000 Received: from mail-oa1-x2d.google.com ([2001:4860:4864:20::2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rFGot-00CeX4-9o for pgsql-hackers@postgresql.org; Mon, 18 Dec 2023 16:50:21 +0000 Received: by mail-oa1-x2d.google.com with SMTP id 586e51a60fabf-203ba1328d1so909144fac.0 for ; Mon, 18 Dec 2023 08:50:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=neon.tech; s=google; t=1702918217; x=1703523017; darn=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=mFWC6aYkxBFAES4iHTcyz3jpAyc2wYToicTnNiAds8Q=; b=sPHBW/CoONJYyNDZybbDRSiloRRC0gLwfoJVdRVLfadPqig+IFQJukMlFNIkcPMTY/ QiDEtckX1en6BFM386V1ug159c5Pua8Q+hAbFjkHjBq3Hyk+rg+9y2CQPujFrImLP/Ds 9fX76CkdjANJNsrohTJSwzac8/izdzyAx6SHg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702918217; x=1703523017; 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=mFWC6aYkxBFAES4iHTcyz3jpAyc2wYToicTnNiAds8Q=; b=vhb+gDvn4wi2yiCUZLnl3T+QXKHYb1V3OIzEyMJWkNo4GM1TbVLho8vhr2Kth977t3 SOPTLKmhk67bMUfqM1fUelO//XuUWZtPaHa3Dt4Ne2381+c1RVD+dNvK6L7gJCo0DiCd XR1NPgbge5CZmazQdRIvQBn2cP9C0iUOvSO1XzIQ8wz0Npugi5ClWNJHoHWAQdPXqBbS nLKO4ZUeOT77xyXfo6v3TI3IwqTnVy1xicHNvBKDELVGBlONhwgZEh/V6OtLOeFsUF3s OjQF1aLe9aSU7G1r46/lTazl3evehZoBfP0e8NCmqEX4PMAF67aNnjtqYTTt6o48Kv32 O9DQ== X-Gm-Message-State: AOJu0YwhX/YA3mvlRvXUM8WwdOyk4IUXpkf8zAd/54t1XhGlPPLANjBj 4kQQPUfqJYMXWAS+0dBdhYPM0w== X-Google-Smtp-Source: AGHT+IEmMsClVNVxY1rGpVEt3w0TJzY852IT4e1sVLQjzLLAIUlFYPOvjK3Pag2Uz8IzIBgzgAflrQ== X-Received: by 2002:a05:6870:c155:b0:203:adc9:ca41 with SMTP id g21-20020a056870c15500b00203adc9ca41mr2490270oad.29.1702918217167; Mon, 18 Dec 2023 08:50:17 -0800 (PST) Received: from localhost ([2607:fb90:e64f:544c:3996:e070:71ee:42fb]) by smtp.gmail.com with ESMTPSA id iv7-20020a056870b9c700b001fb3240116bsm6657978oab.7.2023.12.18.08.50.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Dec 2023 08:50:16 -0800 (PST) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed Date: Mon, 18 Dec 2023 10:50:15 -0600 Message-Id: From: "Tristan Partin" Cc: "Andrew Dunstan" , "Alvaro Herrera" , "Tom Lane" , "Euler Taveira" , "Michael Banck" , "PostgreSQL Hackers" Subject: Re: Add --check option to pgindent To: "Jelte Fennema-Nio" , "Daniel Gustafsson" X-Mailer: aerc 0.16.0-93-gbd29700e708d References: <202312121530.7vztxm3bfyrx@alvherre.pgsql> <4b390361-484d-7598-ac13-db2dd7072ad3@dunslane.net> <46DAFBD4-0387-4F8B-96A2-A39499600C32@yesql.se> In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon Dec 18, 2023 at 10:14 AM CST, Jelte Fennema-Nio wrote: > On Mon, 18 Dec 2023 at 13:42, Daniel Gustafsson wrote: > > I think this is pretty much ready to go, the attached v4 squashes the c= hanges > > and fixes the man-page which also needed an update. The referenced Wik= i page > > will need an edit or two after this goes in, but that's easy enough. > > One thing I'm wondering: When both --check and --diff are passed, > should pgindent still early exit with 2 on the first incorrectly > formatted file? Or should it show diffs for all failing files? I'm > leaning towards the latter making more sense. Makes sense. Let me iterate on the squashed version of the patch. > Related (but not required for this patch): For my pre-commit hook I > would very much like it if there was an option to have pgindent write > the changes to disk, but still exit non-zero, e.g. a --write flag that > could be combined with --check just like --diff and --check can be > combined with this patch. Currently my pre-commit hook need two > separate calls to pgindent to both abort the commit and write the > required changes to disk. I could propose something. It would help if I had an example of such=20 a tool that already exists. --=20 Tristan Partin Neon (https://neon.tech)