From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web11.403.1637104846069991413 for ; Tue, 16 Nov 2021 15:20:46 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=kzQko6OZ; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from [10.0.0.19] (c-73-27-179-174.hsd1.fl.comcast.net [73.27.179.174]) by linux.microsoft.com (Postfix) with ESMTPSA id DBA3920C5A74; Tue, 16 Nov 2021 15:20:44 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DBA3920C5A74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1637104845; bh=lelHEX+cDmWkan4PD9beIiHOTc+2wdqyFtAN43PnDV4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=kzQko6OZfLh8qfexlHCugbJy4aFidX/TddwF3lOUV5fxC9R1cv1gj7mqB98wWReIe Jcji3abHhJ37WpC9pvv7vkZmLYFz0CYLcpV6DwQcHQ7jKt/mxJ4uw2PngcSsivXnni g6Aa5eCWzjQyISiUBeLpHK52RhbAfBYWZrAZOPEg= Message-ID: <6ef9d0eb-942f-943b-5a01-ca7602d31459@linux.microsoft.com> Date: Tue, 16 Nov 2021 18:20:44 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: [edk2-devel] Uncrustify configuration file and file/function templates To: devel@edk2.groups.io, pedro.falcato@gmail.com References: <42fc968b-0108-da06-42a4-d946f0592072@linux.microsoft.com> From: "Michael Kubacki" In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Pedro, By "new config", do you mean the config file in the latest branch=20 https://github.com/makubacki/edk2/blob/uncrustify_poc_5/uncrustify.cfg)? The main difference I see from the diff in that gist and poc_5 is that=20 "align_func_params_gap" and "align_func_params_span" are two instead of=20 zero. The value "force" instead of "add" for "sp_before_sparen" will ensure a=20 single space is always added between a control statement and the=20 parenthesis. Thanks, Michael On 11/16/2021 6:05 PM, Pedro Falcato wrote: > Hi, >=20 > RE: Uncrustify's configuration >=20 > I had made a few changes to the config file, when trying out Uncrustify,= =20 > a few months ago, on Mike Kinney's suggestion. In my experience, the new= =20 > config file reflects the edk2 coding style better. >=20 > In particular, it adds spaces between things like 'if' and the=20 > parenthesis, and better aligns functions' parameters. > Feel free to check out the diff:=20 > https://gist.github.com/heatd/5bb048a188726cb8bc9f5b4a844b0ec2=20 > .=20 > There's a bit of diff noise due to it being based on=20 > https://dev.azure.com/projectmu/_git/Uncrustify?path=3D/etc/edk2.cfg=20 > bu= t=20 > diffed on=20 > https://github.com/makubacki/edk2/blob/uncrustify_poc_2/.uncrustify/edk2.= cfg=20 > . >=20 > Thanks, > Pedro >=20 > On Tue, Nov 16, 2021 at 7:26 PM Michael Kubacki=20 > > wrot= e: >=20 > I think that makes sense. I will look into it further and let you kno= w > if there's any downsides found. >=20 > On 11/16/2021 2:18 PM, Kinney, Michael D wrote: > > Could we add this feature to the Uncrustify CI Plugin? > > > > Mike > > > >> -----Original Message----- > >> From: Michael Kubacki > > >> Sent: Tuesday, November 16, 2021 10:54 AM > >> To: devel@edk2.groups.io ; Kinney, > Michael D > > >> Subject: Re: [edk2-devel] Uncrustify configuration file and > file/function templates > >> > >> I would prefer to have a single version of the file if possible t= o > >> reduce synchronization issues across the two copies. > >> > >> It seems that a CI plugin to read the contents of the template > files and > >> search incoming code for that text wouldn't be too difficult to > add as a > >> new plugin. > >> > >> Thanks, > >> Michael > >> > >> On 11/16/2021 1:31 PM, Michael D Kinney wrote: > >>> Hi Michael, > >>> > >>> Should we have 2 versions of the config file? > >>> > >>> One used by automation tools such as CI and git hooks that do > not use the > >>> templates. > >>> > >>> And another one that a developer can optionally use that will > add the > >>> templates for missing file/function headers that the developer > then needs > >>> to fill out. > >>> > >>> One concern I have about the templates is if they get used but > a developer > >>> does not fill in the missing information.=C2=A0 It would be best= if > a CI check > >>> rejects a file/function header that has not been filled in. > >>> > >>> Mike > >>> > >>>> -----Original Message----- > >>>> From: devel@edk2.groups.io > > On Behalf Of > Michael Kubacki > >>>> Sent: Tuesday, November 16, 2021 10:25 AM > >>>> To: devel@edk2.groups.io ; > Kinney, Michael D > > >>>> Subject: Re: [edk2-devel] Uncrustify configuration file and > file/function templates > >>>> > >>>> Hi Mike, > >>>> > >>>> Those were just disabled because I typically run a separate > invocation > >>>> of Uncrustify with them enabled to isolate code which is missin= g > >>>> file/function headers. My thought was the templates are > helpful but we > >>>> would need to individually identify where they are placed to > file TCBZs > >>>> for maintainers to replace the template with the actual > information. > >>>> > >>>> In some of my previous poc branches (like > >>>> > https://github.com/makubacki/edk2/commits/uncrustify_poc_3_with_heade= rs > ), > I > >>>> also pushed a branch with those results. > >>>> > >>>> So I do think we would want them enabled in the final config > file. We > >>>> can also review the contents of the templates in the future > patch series > >>>> to see if any changes are recommended. > >>>> > >>>> I prefer using a .uncrustify directory to help group related > collateral > >>>> but I don't have a strong opinion there. > >>>> > >>>> Thanks, > >>>> Michael > >>>> > >>>> On 11/16/2021 12:16 PM, Michael D Kinney wrote: > >>>>> Hi Michael, > >>>>> > >>>>> In your POC branch > (https://github.com/makubacki/edk2/tree/uncrustify_poc_5 > ), I see the > >>>>> uncrustify.cfg configuration file in the root. > >>>>> > >>>>> > https://github.com/makubacki/edk2/blob/uncrustify_poc_5/uncrustify.cf= g > > >>>>> > >>>>> However, in your Wiki, you provide examples where this > configuration file is in an > >>>>> .uncrustify directory > >>>>> > >>>>> > https://dev.azure.com/projectmu/Uncrustify/_wiki/wikis/Uncrustify.wik= i/1/Project-Mu-(EDK-II)-Fork-Readme > > >>>>> > >>>>> The uncrustify.cfg files also contains commented out settings > for the file header > >>>>> and function header templates. > >>>>> > >>>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 # cmt_insert_file_header=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =3D > default_file_header.txt > >>>>>=C2=A0 =C2=A0 =C2=A0 =C2=A0 # cmt_insert_func_header=C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =3D > default_function_header.txt > >>>>> > >>>>> Are these disabled on purpose? > >>>>> > >>>>> Do we want to enable them?=C2=A0 If so, should the uncrustify > configuration file > >>>>> and the templates go into a .uncrustify directory? > >>>>> > >>>>> Thanks, > >>>>> > >>>>> Mike > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>>> > >>>> > >>>> > >>>> > >>>> > >>> > >>> > >>> > >>> > >>> > >>> >=20 >=20 >=20 >=20 >=20 >=20 >=20 > --=20 > Pedro Falcato >=20