[Announcement]: Developed an automating tool that can help RTEMS conform with Python coding style

Joel Sherrill joel at rtems.org
Wed Sep 2 23:07:19 UTC 2020


On Wed, Sep 2, 2020, 5:51 PM Chris Johns <chrisj at rtems.org> wrote:

> On 3/9/20 7:39 am, Gedare Bloom wrote:
> > On Wed, Sep 2, 2020 at 2:00 PM Mritunjay Sharma
> > <mritunjaysharma394 at gmail.com> wrote:
> >>
> >> Hello everyone!
> >>
> >> After recently seeing the Python Development
> >> guidelines for RTEMS, I found that
> >> "RTEMS Tools should be piped through the yapf Python code
> >> formatter before it is committed or sent for review."
> >>
> >> This gave me an idea to build something that can automate
> >> this process and take the pressure off both from
> >> Maintainers as well as Contributors.
> >>
> >> I am pleased to tell you that I have successfully implemented this
> >> idea by building an open-source GitHub action called 'autoyapf'.
> >>
> >> Link to the tool is: https://github.com/marketplace/actions/autoyapf
> >> Link to the github repo: https://github.com/mritunjaysharma394/autoyapf
> >>
> >> What it does is that whenever a maintainer pushes a python code in the
> repo
> >> or merges a PR of a contributor containing Python code, autoyapf action
> is
> >> triggered and it automatically checks if the file is piped in 'yapf'
> format or not
> >> and if not then it will automatically commit the changes in concerned
> file
> >> to make it follow the PEP 8 style guide using yapf.
> >>
> >
> > Interesting concept. I think this would be more useful a bit earlier
> > in the development pipeline though. What about as a pre-commit
> > githook?
>
> It is interesting and I like the idea of some support but we are not a
> github
> hosted project so workflows will not work for us. Plus at the moment the
> repos I
> am interested in need to be converted to yapf for any support like this to
> work.
> The yapf changes are not too bad, the pylint changes, which are worth
> doing,
> take a lot longer.
>
> I am running `yapf -i myfile.py` before I create the commit. This way I
> check
> the changes as part of a review before creating the commit.
>
> Could the precommit hook simply stop the commit and force you to run yapf
> if
> there is a required change? Would this require you have yapf installed?
>

I think I would be ok with this behaviour. Whatever free checkers we use
should be no problem to expect someone to have and run.

We just have to be clean first. :)

--joel

>
> Chris
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200902/dc53a928/attachment.html>


More information about the devel mailing list