Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122423 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id B98411ACEBF for ; Sun, 18 Feb 2024 04:24:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708230294; bh=RDXAcJNzF3o3C7gSzBwORSLv3fMiiza+naVtnWkhtsI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=QnkYqj4HTmdR47QpLauoo03BFGo2g8eUg024avuzg4gV9i8Gc9xP6Ti8n9RxpYAES 1E8YIXv0VQ+ubXtaO4wHbJ/KoHbVrCFEySEl3rBoINcjrmQLfarjyvso0qJY6Gzirx tLdHMzGAIaiUa8dTU+RrvCvPm1BUGi/h2pm5iMAupOX3umsvNANDuqNo7IVw4vY/ho sMdugMmwA26H5tt1Tdo3ABrm6Eumcw0a0uVb76TCkYvrwgJUto4Y8VuDEFfa9u1IW1 X8YTFQXRbIhJ360mrSW9thdmxJbdBoG843xeeorN6sgvrzCJ82QBkhsmqDbizv8Bz8 gexHwFbJb9Jew== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3DF64182224 for ; Sun, 18 Feb 2024 04:24:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (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 php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 17 Feb 2024 20:24:49 -0800 (PST) Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6dc8b280155so1899811a34.0 for ; Sat, 17 Feb 2024 20:24:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708230286; x=1708835086; darn=lists.php.net; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=RDXAcJNzF3o3C7gSzBwORSLv3fMiiza+naVtnWkhtsI=; b=VkIZt3uNsZ8lP5SB00cuo6jaF0TtOS+owtgAXsTS0av9oWHNzesJ39e0vL5erKGmPt 0noyEA69LX0KD0mu+ePx8v2/f2fZeX04HZMdbNVAiX3yXEPvUjA9QWgPBM8kbwMUIDTc QNg5tm/InqdELX0NFnfUtxPeCHohWWi0GLXAIsMULc/gdC2nkrahwLjdevESPSq3Li1D EXjhWMG+FneeOukGVo7wu9cGljDUifr9HEk79dFzKljfy72O6WbeHZgragA1OOciz1ry sTFmoj2BSQUhhsI9kDmc9wAjpY5vBw0+iwOX56FD9YrtlQC0zDD8CKDu449UiNu2Tfat hkbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708230286; x=1708835086; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RDXAcJNzF3o3C7gSzBwORSLv3fMiiza+naVtnWkhtsI=; b=IDVIRkyCx/+ruvHDXgcx5xBAqSKr+NAJzzUEICsj9YJ7kiS1LZiIeNSxq2DjPcO/JH UT/SGpeiBn9SmcY0aBn1DfKPRG0SVj/BHDQLSvWLZGptCFVQHfb4wg3JaaDw2tLlPXCw cxhGBvRf8os6Nkxcsq7d7kYFFsxVOA9zCASOPnhtoVGQjqcQ6fg7NofAdD3/SX+CggOz pIvzdapF79J03KonSoyJlqGBNlaYhpDWSg+jHl/OF6BKu2d84HpxmirqP8CBZEh7f8KF vfZcaLdNpyuYQU8/ah2tAHcX0K1ZyyoagY+iA1keSkk2NaxZHDuDL8DATLrAftu3cuOQ IxuQ== X-Gm-Message-State: AOJu0YyOkt4ckzuUbGJkMC83scsUA4jYXGDu4lKHBtV0CtOV9cUky4rB juH0ykRZkobLZ66hVjJ/fh72+OurZwjt7GlB7XnwcbR2iIBJYlk/sT6UiknmBBcrk1nSnrARUie M7CAkfnnZd4ft2+VWU7n8wvLVyy4XqI0wjLkervt2 X-Google-Smtp-Source: AGHT+IGF5XlJ0wgmrkj/6u6YRWgLQs3WtjDAXaqSljG3WCUudn4QmoX18If4HPwZ3AQOwTUr9j9+lrYuuu8/nh0o5Xk= X-Received: by 2002:a05:6871:7401:b0:21e:b4d0:9961 with SMTP id nw1-20020a056871740100b0021eb4d09961mr630916oac.55.1708230286106; Sat, 17 Feb 2024 20:24:46 -0800 (PST) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 References: <4EB2FF2E-84F9-4603-BEDC-7A359539FD97@php.net> In-Reply-To: <4EB2FF2E-84F9-4603-BEDC-7A359539FD97@php.net> Date: Sun, 18 Feb 2024 05:24:09 +0100 Message-ID: Subject: Re: [PHP-DEV] automatic formatting checks for pull requests? To: Derick Rethans Cc: internals@lists.php.net Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: divinity76@gmail.com (Hans Henrik Bergan) i have tested running clang-format against the entire php-src codebase, and there is only 1 file it breaks: ext/spl/spl_directory_arginfo.h more details at https://github.com/php/php-src/pull/13417#issuecomment-1950920114 On Sun, 18 Feb 2024 at 01:45, Derick Rethans wrote: > > On 17 February 2024 22:18:05 GMT, Ilija Tovilo w= rote: > >Hi Hans > > > >On Sat, Feb 17, 2024 at 3:31=E2=80=AFPM Gina P. Banyard wrote: > >> > >> On Saturday, 17 February 2024 at 11:24, Hans Henrik Bergan wrote: > >> > >> > Can we add automatic formatting checks for pull requests? > >> > Made a PR: https://github.com/php/php-src/pull/13417 > >> > >> It would be nice to have some formatting rules to harmonize the codeba= se as it is somewhat the wild west, > >> but as far as my understanding goes is that Clang format struggles to = understand our codebase (namely macros) and is difficult to set-up for php-= src. > > > >Right. Consistent code style is nice, but what we have now is really > >not that bad. There are a couple things I'd want if we enforce code > >style: > > > >* Fixing the style should be easy, running a single command without > >first pushing to CI. > >* It should be fast too, so that I can easily run it for every commit, > >preferably even on-save in my editor. > >* The new code style should be applied only to newly added sections or > >changed code, not entire files. Otherwise, we'll have many changes in > >large files, with endless merge conflicts when merging up from lower > >branches. > >* The formatting tool should work for all php-src code, not just plain > >C code. We don't want to be forced to refactor old macros just because > >we need to add a single line to some long-standing code. Last time I > >tried clang-format, it utterly failed with our macros. > > > >I haven't looked at your PR in detail, so I'm not sure which of these > >points it satisfies. It would be great if you could quickly describe > >how it works, and what the goals are. > > > >Essentially, I'm just sceptical that this isn't more trouble than it's w= orth. > > > >Ilija > > IMO, clang-format isn't really suitable. Its untunable style is often far= from the coding style that we currently have, and it makes some really odd= choices as to when and how to wrap lines, making code definitely less read= able. > > cheers > Derick > IMO, clang-format isn't really suitable. Its untunable style is often far= from the coding style that we currently have, and it makes some really odd= choices as to when and how to wrap lines, making code definitely less read= able. it is far from "untunable", the manpage for tuning is huge: https://clang.llvm.org/docs/ClangFormatStyleOptions.html