GSoC - Code Formatting and Style Checking for RTEMS score

Gedare Bloom gedare at rtems.org
Wed Aug 11 16:07:06 UTC 2021


On Tue, Aug 10, 2021 at 3:21 PM Ida Delphine <idadelm at gmail.com> wrote:
>
> Hi everyone,
> I was able to successfully build LLVM from source using "ninja" instead of "make" after a couple of failed attempts because I kept running out of resources.
>
> Is there anything else I am supposed to do as far building LLVM is concerned? Or will every user first have to clone the llvm repo and build it from source like I did?
>
I think it would be good to update/provide RSB recipe for newer
version(s) of LLVM. If you can do that after the GSoC coding period
ends, that would be great.

> On Fri, 16 Jul 2021, 5:28 am Chris Johns, <chrisj at rtems.org> wrote:
>>
>> Hi,
>>
>> I will bring the discussion to the devel list and I hope the comments are in
>> line with the purpose of the project. Please correct what I say if it is not.
>>
>> The pre-commit script that is in github review is a good base and I believe it
>> solves that problem for those on Linux. It is a great start and it is nice to see.
>>
>> The work needs to mature and progress and that means a few things. I was
>> approached by Joel about where this would live in rtems-tools. As the script
>> stands it is not suitable for rtems-tool because the format is specific to the
>> score code in rtems.git.
>>
>> I think a pre-commit script needs to live in the repo it is for in a spot a user
>> can copy to the hooks directory of their repo. For example `git-hooks`.
>>
>> A git hooks script for rtems.git needs to run on all the supported hosts or we
>> may result in patches being left on the floor. If a contributor's host OS is not
>> supported and the patch is rejected for formatting reasons picked up by the
>> check the contributor may just walk away.
>>
>> The script should use `/usr/bin/env python3` and it needs to check for a range
>> of `clang-format` instances. FreeBSD has a package that installs the format
>> command as `clang-format10` for LLVM 10 and `clang-format11` for version 11.
>>
>> A contributor being able to run the script may depend on the host having a
>> package or packages installed. Given this is for RTEMS development that is fine.
>> The script needs to handle any set up errors nicely if something is missing. I
>> prefer we avoid the "experts" approach to error management.
>>
>> There is possible future work adding a command to rtems-tools. Ida and I
>> discussed this on discord and we decided a command called `rtems-style` would be
>> nice. It would be nice if that command checked, ie `--mode=check`, a style as
>> well as `--mode=reformat` to automatically reformat a source file.
>>
>> A command for rtems-tools has to support python2 and python3 and it has to
>> handle errors in suitable manner. Printing uncaught exception is not OK. It
>> should also be self contained and not depend on any pip python packages.
>>
>> If an `rtems-style` command is created and installed when rtems-tool is
>> installed the pre-commit git script could be made to use it and so the style is
>> held in a single location.
>>
>> Finally an rtems-style command could be extended to support python
>> (--lang=python) or other styles for other code formats. This is inline with our
>> other eco-system interfaces we provide.
>>
>> I hope this helps.
>>
>> Chris
>>
>> On 16/7/21 5:13 am, Ida Delphine wrote:
>> > I will check on this
>> >
>> > On Thu, Jul 15, 2021 at 3:39 PM Gedare Bloom <gedare at rtems.org
>> > <mailto:gedare at rtems.org>> wrote:
>> >
>> >     On Thu, Jul 15, 2021 at 5:19 AM Ida Delphine <idadelm at gmail.com
>> >     <mailto:idadelm at gmail.com>> wrote:
>> >     >
>> >     > Hello everyone,
>> >     > From the discussion on discord it looks like clang-format cannot be
>> >     installed on MacOS and FreeBSD. Is there any alternative or way to have it
>> >     on these operating systems?
>> >     >
>> >     What are the challenges with them? Can clang-format be built from
>> >     source on those hosts?
>> >
>> >     > On Wed, 5 May 2021, 10:21 pm Ida Delphine, <idadelm at gmail.com
>> >     <mailto:idadelm at gmail.com>> wrote:
>> >     >>
>> >     >> Hello everyone,
>> >     >>
>> >     >> Regarding this project (https://devel.rtems.org/ticket/3860
>> >     <https://devel.rtems.org/ticket/3860>) I went with clang-format as we all
>> >     agreed. I have tested it on some "score" files and it made some changes
>> >     which I don't think are very much in line with the RTEMS coding style.
>> >     However, it wasn't really clear if we will chage the RTEMS coding style or
>> >     try to make changes to clang-format to fit the style.
>> >     >> Please will love to know the best option.
>> >     >>
>> >     >> Cheers,
>> >     >> Ida.
>> >     >
>> >     > _______________________________________________
>> >     > devel mailing list
>> >     > devel at rtems.org <mailto:devel at rtems.org>
>> >     > http://lists.rtems.org/mailman/listinfo/devel
>> >     <http://lists.rtems.org/mailman/listinfo/devel>
>> >
>> >
>> > _______________________________________________
>> > devel mailing list
>> > devel at rtems.org
>> > http://lists.rtems.org/mailman/listinfo/devel
>> >


More information about the devel mailing list