<div dir="ltr"><div>Hi,</div><div><br></div><div>RE: Uncrustify's configuration<br></div><div><br></div><div>I had made a few changes to the config file, when trying out Uncrustify, a few months ago, on Mike Kinney's suggestion. In my experience, the new config file reflects the edk2 coding style better.</div><div><br></div><div>In particular, it adds spaces between things like 'if' and the <span><span>parenthesis, and better aligns functions' parameters.</span></span></div><div><span><span>Feel free to check out the diff: <a href="https://gist.github.com/heatd/5bb048a188726cb8bc9f5b4a844b0ec2">https://gist.github.com/heatd/5bb048a188726cb8bc9f5b4a844b0ec2</a>. There's a bit of diff noise due to it being based on <a href="https://dev.azure.com/projectmu/_git/Uncrustify?path=/etc/edk2.cfg">https://dev.azure.com/projectmu/_git/Uncrustify?path=/etc/edk2.cfg</a> but diffed on <a href="https://github.com/makubacki/edk2/blob/uncrustify_poc_2/.uncrustify/edk2.cfg">https://github.com/makubacki/edk2/blob/uncrustify_poc_2/.uncrustify/edk2.cfg</a>.</span></span></div><div><span><span><br></span></span></div><div><span><span>Thanks,<br></span></span></div><div><span><span>Pedro<br></span></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 16, 2021 at 7:26 PM Michael Kubacki <<a href="mailto:mikuback@linux.microsoft.com">mikuback@linux.microsoft.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I think that makes sense. I will look into it further and let you know <br>
if there's any downsides found.<br>
<br>
On 11/16/2021 2:18 PM, Kinney, Michael D wrote:<br>
> Could we add this feature to the Uncrustify CI Plugin?<br>
> <br>
> Mike<br>
> <br>
>> -----Original Message-----<br>
>> From: Michael Kubacki <<a href="mailto:mikuback@linux.microsoft.com" target="_blank">mikuback@linux.microsoft.com</a>><br>
>> Sent: Tuesday, November 16, 2021 10:54 AM<br>
>> To: <a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a>; Kinney, Michael D <<a href="mailto:michael.d.kinney@intel.com" target="_blank">michael.d.kinney@intel.com</a>><br>
>> Subject: Re: [edk2-devel] Uncrustify configuration file and file/function templates<br>
>><br>
>> I would prefer to have a single version of the file if possible to<br>
>> reduce synchronization issues across the two copies.<br>
>><br>
>> It seems that a CI plugin to read the contents of the template files and<br>
>> search incoming code for that text wouldn't be too difficult to add as a<br>
>> new plugin.<br>
>><br>
>> Thanks,<br>
>> Michael<br>
>><br>
>> On 11/16/2021 1:31 PM, Michael D Kinney wrote:<br>
>>> Hi Michael,<br>
>>><br>
>>> Should we have 2 versions of the config file?<br>
>>><br>
>>> One used by automation tools such as CI and git hooks that do not use the<br>
>>> templates.<br>
>>><br>
>>> And another one that a developer can optionally use that will add the<br>
>>> templates for missing file/function headers that the developer then needs<br>
>>> to fill out.<br>
>>><br>
>>> One concern I have about the templates is if they get used but a developer<br>
>>> does not fill in the missing information.  It would be best if a CI check<br>
>>> rejects a file/function header that has not been filled in.<br>
>>><br>
>>> Mike<br>
>>><br>
>>>> -----Original Message-----<br>
>>>> From: <a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a> <<a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a>> On Behalf Of Michael Kubacki<br>
>>>> Sent: Tuesday, November 16, 2021 10:25 AM<br>
>>>> To: <a href="mailto:devel@edk2.groups.io" target="_blank">devel@edk2.groups.io</a>; Kinney, Michael D <<a href="mailto:michael.d.kinney@intel.com" target="_blank">michael.d.kinney@intel.com</a>><br>
>>>> Subject: Re: [edk2-devel] Uncrustify configuration file and file/function templates<br>
>>>><br>
>>>> Hi Mike,<br>
>>>><br>
>>>> Those were just disabled because I typically run a separate invocation<br>
>>>> of Uncrustify with them enabled to isolate code which is missing<br>
>>>> file/function headers. My thought was the templates are helpful but we<br>
>>>> would need to individually identify where they are placed to file TCBZs<br>
>>>> for maintainers to replace the template with the actual information.<br>
>>>><br>
>>>> In some of my previous poc branches (like<br>
>>>> <a href="https://github.com/makubacki/edk2/commits/uncrustify_poc_3_with_headers" rel="noreferrer" target="_blank">https://github.com/makubacki/edk2/commits/uncrustify_poc_3_with_headers</a>), I<br>
>>>> also pushed a branch with those results.<br>
>>>><br>
>>>> So I do think we would want them enabled in the final config file. We<br>
>>>> can also review the contents of the templates in the future patch series<br>
>>>> to see if any changes are recommended.<br>
>>>><br>
>>>> I prefer using a .uncrustify directory to help group related collateral<br>
>>>> but I don't have a strong opinion there.<br>
>>>><br>
>>>> Thanks,<br>
>>>> Michael<br>
>>>><br>
>>>> On 11/16/2021 12:16 PM, Michael D Kinney wrote:<br>
>>>>> Hi Michael,<br>
>>>>><br>
>>>>> In your POC branch (<a href="https://github.com/makubacki/edk2/tree/uncrustify_poc_5" rel="noreferrer" target="_blank">https://github.com/makubacki/edk2/tree/uncrustify_poc_5</a>), I see the<br>
>>>>> uncrustify.cfg configuration file in the root.<br>
>>>>><br>
>>>>>        <a href="https://github.com/makubacki/edk2/blob/uncrustify_poc_5/uncrustify.cfg" rel="noreferrer" target="_blank">https://github.com/makubacki/edk2/blob/uncrustify_poc_5/uncrustify.cfg</a><br>
>>>>><br>
>>>>> However, in your Wiki, you provide examples where this configuration file is in an<br>
>>>>> .uncrustify directory<br>
>>>>><br>
>>>>>        <a href="https://dev.azure.com/projectmu/Uncrustify/_wiki/wikis/Uncrustify.wiki/1/Project-Mu-(EDK-II)-Fork-Readme" rel="noreferrer" target="_blank">https://dev.azure.com/projectmu/Uncrustify/_wiki/wikis/Uncrustify.wiki/1/Project-Mu-(EDK-II)-Fork-Readme</a><br>
>>>>><br>
>>>>> The uncrustify.cfg files also contains commented out settings for the file header<br>
>>>>> and function header templates.<br>
>>>>><br>
>>>>>        # cmt_insert_file_header          = default_file_header.txt<br>
>>>>>        # cmt_insert_func_header          = default_function_header.txt<br>
>>>>><br>
>>>>> Are these disabled on purpose?<br>
>>>>><br>
>>>>> Do we want to enable them?  If so, should the uncrustify configuration file<br>
>>>>> and the templates go into a .uncrustify directory?<br>
>>>>><br>
>>>>> Thanks,<br>
>>>>><br>
>>>>> Mike<br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>>><br>
>>><br>
>>><br>
>>><br>
>>> <br>
>>><br>
>>><br>
<br>
<br>
<br>
<br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr">Pedro Falcato</div></div>


 <div width="1" style="color:white;clear:both">_._,_._,_</div> <hr>   Groups.io Links:<p>   You receive all messages sent to this group.    <p> <a target="_blank" href="https://edk2.groups.io/g/devel/message/83794">View/Reply Online (#83794)</a> |    |  <a target="_blank" href="https://groups.io/mt/87100207/1813853">Mute This Topic</a>  | <a href="https://edk2.groups.io/g/devel/post">New Topic</a><br>    <a href="https://edk2.groups.io/g/devel/editsub/1813853">Your Subscription</a> | <a href="mailto:devel+owner@edk2.groups.io">Contact Group Owner</a> |  <a href="https://edk2.groups.io/g/devel/unsub">Unsubscribe</a>  [edk2-devel-archive@redhat.com]<br> <div width="1" style="color:white;clear:both">_._,_._,_</div>