Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:122419 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 8571E1AE37E for ; Sun, 18 Feb 2024 00:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1708214461; bh=uvM5/6tUSF3q4WIgizCsywguzfdZwd+njdAPhG3keWE=; h=Date:From:To:Subject:In-Reply-To:References:From; b=c16FJwya0xC7ywricswEe/EfIq6gFGITIIWIREIYVZoocUGQ/1zJDltLCKFliB2bu YT029TpfyPqshRZmpc0C9n/5Qw5BzYrbY5/xZPEnoy0BJWfIeMYBaWcBFdWg0j0AgO /wUXRxO3uTMaY/kUMNFfGPPQqXEWE27P+xGjK297fKSkzDqu5yDxIU456HPHCwE4ob BOwEEYeF95rr4WXzF6vJsyQG1Dk5UHJCvvnsZWAUfPmCwQOZUu3PWW8GKJszAXdJaM xuffeL5FpaQg2ZpLWuFJmoabfPYGH/HAohdu1O1n6UVo8olNPAPCCTCbNMPvUkZV5j TEVhQOKJtYVhw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 0554B181C2B for ; Sun, 18 Feb 2024 00:01:00 +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=0.8 required=5.0 tests=BAYES_20,DMARC_MISSING, SPF_HELO_PASS,SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Sat, 17 Feb 2024 16:00:58 -0800 (PST) Received: from [127.0.0.1] (unknown [148.252.147.99]) by xdebug.org (Postfix) with ESMTPSA id 980D210C530; Sun, 18 Feb 2024 00:00:54 +0000 (GMT) Date: Sun, 18 Feb 2024 00:00:55 +0000 To: internals@lists.php.net Subject: Re: [PHP-DEV] automatic formatting checks for pull requests? User-Agent: K-9 Mail for Android In-Reply-To: References: Message-ID: <4EB2FF2E-84F9-4603-BEDC-7A359539FD97@php.net> Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: derick@php.net (Derick Rethans) On 17 February 2024 22:18:05 GMT, Ilija Tovilo = wrote: >Hi Hans > >On Sat, Feb 17, 2024 at 3:31=E2=80=AFPM Gina P=2E 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=2Ecom/php/php-src/pull/13417 >> >> It would be nice to have some formatting rules to harmonize the codebas= e as it is somewhat the wild west, >> but as far as my understanding goes is that Clang format struggles to u= nderstand our codebase (namely macros) and is difficult to set-up for php-s= rc=2E > >Right=2E Consistent code style is nice, but what we have now is really >not that bad=2E 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=2E >* It should be fast too, so that I can easily run it for every commit, >preferably even on-save in my editor=2E >* The new code style should be applied only to newly added sections or >changed code, not entire files=2E Otherwise, we'll have many changes in >large files, with endless merge conflicts when merging up from lower >branches=2E >* The formatting tool should work for all php-src code, not just plain >C code=2E 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=2E Last time I >tried clang-format, it utterly failed with our macros=2E > >I haven't looked at your PR in detail, so I'm not sure which of these >points it satisfies=2E It would be great if you could quickly describe >how it works, and what the goals are=2E > >Essentially, I'm just sceptical that this isn't more trouble than it's wo= rth=2E > >Ilija IMO, clang-format isn't really suitable=2E Its untunable style is often fa= r from the coding style that we currently have, and it makes some really od= d choices as to when and how to wrap lines, making code definitely less rea= dable=2E cheers Derick