State of Yocto styleguide and oe-stylize.py script


VIVAVIS AG
 

Hi,

I'm wondering whether the styleguide www.openembedded.org/wiki/Styleguide,
meta-openembedded/contrib/oe-stylize.py or none of them is the source of
truth for writing a good recipe.

E.g., if you run oe-stylize.py, the SRCREV variable is placed above SRC_URI,
or RDEPENDS is placed above FILES, which is not what the Wiki documents.
And there are more discrepancies of this type.

Furthermore, the script doesn't know the FILESEXTRAPATHS variable in bbappend files
and moves it to the end of my recipe. Well, this is not decribed in the Wiki, but a look
into append files in meta-openembedded shows, that it is common pactice to put
FILESEXTRAPATHS in the first line of the recipe.

The Wiki has an interesting note and the end: "You can run contrib/oe-stylize.py from
meta-oe on your recipes before submitting them; however it is not necessarily up-to-date
with all current style conventions. This page should be considered the canonical reference."

Furthermore, there's github.com/openembedded/meta-openembedded/pull/465
providing another ruleset for the new linter.

So, my question to the Yocto maintainers is, what is the current state of the styleguide
and oe-stylize.py? Are there plans to synchronize them?

Thanks for clarification.

Carsten Stelling


Khem Raj
 

On 3/13/23 7:20 AM, VIVAVIS AG via lists.yoctoproject.org wrote:
Hi,
I'm wondering whether the styleguide www.openembedded.org/wiki/Styleguide,
meta-openembedded/contrib/oe-stylize.py or none of them is the source of
truth for writing a good recipe.
E.g., if you run oe-stylize.py, the SRCREV variable is placed above SRC_URI,
or RDEPENDS is placed above FILES, which is not what the Wiki documents.
And there are more discrepancies of this type.
Furthermore, the script doesn't know the FILESEXTRAPATHS variable in bbappend files
and moves it to the end of my recipe. Well, this is not decribed in the Wiki, but a look
into append files in meta-openembedded shows, that it is common pactice to put
FILESEXTRAPATHS in the first line of the recipe.
The Wiki has an interesting note and the end: "You can run contrib/oe-stylize.py from
meta-oe on your recipes before submitting them; however it is not necessarily up-to-date
with all current style conventions. This page should be considered the canonical reference."
Furthermore, there's github.com/openembedded/meta-openembedded/pull/465
providing another ruleset for the new linter.
So, my question to the Yocto maintainers is, what is the current state of the styleguide
and oe-stylize.py? Are there plans to synchronize them?
oe-stylize.py is still the linter of choice but as you have noted it has been lacking on certain areas and wiki should be updated to match what it produces. It does need some TLC and patches are welcome.

Thanks for clarification.
Carsten Stelling


Alexander Kanavin
 

There is not a lot of interest in maintaining style guides, and
associated tooling. My personal feeling is that they don't really help
with the truly problematic things in recipes that need a human eye (or
chatgpt level intelligence :) - by and large people do follow
reasonable order of entries for example, and nitpicking on an exact
order would just be wasting precious maintainer time.

If you want to ensure good quality, making your layer pass the yocto
compatibility script, and ensuring there are no warnings of any kind
from bitbake when built with latest master revisions of everything is
a better first step in my opinion.

Alex

On Mon, 13 Mar 2023 at 15:20, VIVAVIS AG via lists.yoctoproject.org
<embedded=vivavis.com@...> wrote:

Hi,

I'm wondering whether the styleguide www.openembedded.org/wiki/Styleguide,
meta-openembedded/contrib/oe-stylize.py or none of them is the source of
truth for writing a good recipe.

E.g., if you run oe-stylize.py, the SRCREV variable is placed above SRC_URI,
or RDEPENDS is placed above FILES, which is not what the Wiki documents.
And there are more discrepancies of this type.

Furthermore, the script doesn't know the FILESEXTRAPATHS variable in bbappend files
and moves it to the end of my recipe. Well, this is not decribed in the Wiki, but a look
into append files in meta-openembedded shows, that it is common pactice to put
FILESEXTRAPATHS in the first line of the recipe.

The Wiki has an interesting note and the end: "You can run contrib/oe-stylize.py from
meta-oe on your recipes before submitting them; however it is not necessarily up-to-date
with all current style conventions. This page should be considered the canonical reference."

Furthermore, there's github.com/openembedded/meta-openembedded/pull/465
providing another ruleset for the new linter.

So, my question to the Yocto maintainers is, what is the current state of the styleguide
and oe-stylize.py? Are there plans to synchronize them?

Thanks for clarification.

Carsten Stelling



Martin Jansa
 

On Mon, Mar 13, 2023 at 6:34 PM Alexander Kanavin <alex.kanavin@...> wrote:
There is not a lot of interest in maintaining style guides, and
associated tooling. My personal feeling is that they don't really help
with the truly problematic things in recipes that need a human eye (or
chatgpt level intelligence :) - by and large people do follow
reasonable order of entries for example, and nitpicking on an exact
order would just be wasting precious maintainer time.

I agree that there are other more important things, but I also like style (only in code - human looks are overrated :)).

If the tool is executed locally before sending the contribution (and Carsten does seem interested in doing just that - not asking Khem to run it on incoming patches) then I believe it can save maintainers time by sending better patches on first try not waste it and our styleguide really needs some TLC as Carsten found out.

The same does apply to e.g. scripts/contrib/patchreview.py.

If the missing/malformed Upstream-Status is reported to the original contributor before he/she/it sends the patch, by some at least well documented work flow how to submit patches, then it saves more maintainer time, than asking for it during e-mail review or worse after the change is merged or built by maintainer and QA check reports it's missing or malformed.

If someone is willing to help with the tooling, we should endorse that, not discourage them even when there are bigger-greater goals like yocto-check-layer script you mentioned.

Cheers,

If you want to ensure good quality, making your layer pass the yocto
compatibility script, and ensuring there are no warnings of any kind
from bitbake when built with latest master revisions of everything is
a better first step in my opinion.

Alex

On Mon, 13 Mar 2023 at 15:20, VIVAVIS AG via lists.yoctoproject.org
<embedded=vivavis.com@...> wrote:
>
> Hi,
>
> I'm wondering whether the styleguide www.openembedded.org/wiki/Styleguide,
> meta-openembedded/contrib/oe-stylize.py or none of them is the source of
> truth for writing a good recipe.
>
> E.g., if you run oe-stylize.py, the SRCREV variable is placed above SRC_URI,
> or RDEPENDS is placed above FILES, which is not what the Wiki documents.
> And there are more discrepancies of this type.
>
> Furthermore, the script doesn't know the FILESEXTRAPATHS variable in bbappend files
> and moves it to the end of my recipe. Well, this is not decribed in the Wiki, but a look
> into append files in meta-openembedded shows, that it is common pactice to put
> FILESEXTRAPATHS in the first line of the recipe.
>
> The Wiki has an interesting note and the end: "You can run contrib/oe-stylize.py from
> meta-oe on your recipes before submitting them; however it is not necessarily up-to-date
> with all current style conventions. This page should be considered the canonical reference."
>
> Furthermore, there's github.com/openembedded/meta-openembedded/pull/465
> providing another ruleset for the new linter.
>
> So, my question to the Yocto maintainers is, what is the current state of the styleguide
> and oe-stylize.py? Are there plans to synchronize them?
>
> Thanks for clarification.
>
> Carsten Stelling
>
>
>




VIVAVIS AG
 

Thank you for all your answers on this topic.

 

My realization from the discussion is, that there’s currently no definitive

guide on how to order variables and tasks. So we’re going to proceed with our

BCP and write recipes following the Styleguide and based on recipes in meta

and meta-openembedded. If the style differs within these layers too, we do

some sort of majority decision.

 

Therefore, the first line of our bbappend files would normally start with

the FILESEXTRAPATHS variable for instance, like in most recipes of these

public layers. oe-stylize.py places this at the end of the file, which looks

a little bit strange for us. I understand Alexander, saying it must look good

to the tools not for human eyes, but maybe the truth lies in between.

 

Maybe, or hopefully the maintainers of the YP will maintain and update

the styleguide (in my opinion the canonical reference) and adapt the tools

to minimize the gap between specifications.

As formerly stated, this may reduce discussions and overhead when

contributing to the YP relating to recipes.

 

Carsten

 

Von: Martin Jansa <martin.jansa@...>
Gesendet: Montag, 13. März 2023 19:00
An: Alexander Kanavin <alex.kanavin@...>
Cc: embedded (VIVAVIS AG) <embedded@...>; yocto@...
Betreff: Re: [yocto] State of Yocto styleguide and oe-stylize.py script

 

On Mon, Mar 13, 2023 at 6:34 PM Alexander Kanavin <alex.kanavin@...> wrote:

There is not a lot of interest in maintaining style guides, and
associated tooling. My personal feeling is that they don't really help
with the truly problematic things in recipes that need a human eye (or
chatgpt level intelligence :) - by and large people do follow
reasonable order of entries for example, and nitpicking on an exact
order would just be wasting precious maintainer time.

 

I agree that there are other more important things, but I also like style (only in code - human looks are overrated :)).

 

If the tool is executed locally before sending the contribution (and Carsten does seem interested in doing just that - not asking Khem to run it on incoming patches) then I believe it can save maintainers time by sending better patches on first try not waste it and our styleguide really needs some TLC as Carsten found out.

 

The same does apply to e.g. scripts/contrib/patchreview.py.

 

If the missing/malformed Upstream-Status is reported to the original contributor before he/she/it sends the patch, by some at least well documented work flow how to submit patches, then it saves more maintainer time, than asking for it during e-mail review or worse after the change is merged or built by maintainer and QA check reports it's missing or malformed.

 

If someone is willing to help with the tooling, we should endorse that, not discourage them even when there are bigger-greater goals like yocto-check-layer script you mentioned.

 

Cheers,

 

If you want to ensure good quality, making your layer pass the yocto
compatibility script, and ensuring there are no warnings of any kind
from bitbake when built with latest master revisions of everything is
a better first step in my opinion.

Alex

On Mon, 13 Mar 2023 at 15:20, VIVAVIS AG via lists.yoctoproject.org
<embedded=vivavis.com@...> wrote:
>
> Hi,
>
> I'm wondering whether the styleguide www.openembedded.org/wiki/Styleguide,
> meta-openembedded/contrib/oe-stylize.py or none of them is the source of
> truth for writing a good recipe.
>
> E.g., if you run oe-stylize.py, the SRCREV variable is placed above SRC_URI,
> or RDEPENDS is placed above FILES, which is not what the Wiki documents.
> And there are more discrepancies of this type.
>
> Furthermore, the script doesn't know the FILESEXTRAPATHS variable in bbappend files
> and moves it to the end of my recipe. Well, this is not decribed in the Wiki, but a look
> into append files in meta-openembedded shows, that it is common pactice to put
> FILESEXTRAPATHS in the first line of the recipe.
>
> The Wiki has an interesting note and the end: "You can run contrib/oe-stylize.py from
> meta-oe on your recipes before submitting them; however it is not necessarily up-to-date
> with all current style conventions. This page should be considered the canonical reference."
>
> Furthermore, there's github.com/openembedded/meta-openembedded/pull/465
> providing another ruleset for the new linter.
>
> So, my question to the Yocto maintainers is, what is the current state of the styleguide
> and oe-stylize.py? Are there plans to synchronize them?
>
> Thanks for clarification.
>
> Carsten Stelling
>
>
>


Tim Orling
 



On Fri, Mar 17, 2023 at 5:51 AM VIVAVIS AG via lists.yoctoproject.org <embedded=vivavis.com@...> wrote:

Thank you for all your answers on this topic.

 

My realization from the discussion is, that there’s currently no definitive

guide on how to order variables and tasks. So we’re going to proceed with our

BCP and write recipes following the Styleguide and based on recipes in meta

and meta-openembedded. If the style differs within these layers too, we do

some sort of majority decision.

 

Therefore, the first line of our bbappend files would normally start with

the FILESEXTRAPATHS variable for instance, like in most recipes of these

public layers. oe-stylize.py places this at the end of the file, which looks

a little bit strange for us. I understand Alexander, saying it must look good

to the tools not for human eyes, but maybe the truth lies in between.

 

Maybe, or hopefully the maintainers of the YP will maintain and update


This is an open source community project, so as an interested user, you count as a maintainer :)

I say this because it would be great if you used this valuable time and energy you have spent to help the next person. Your observations are excellent and should be captured.

the styleguide (in my opinion the canonical reference) and adapt the tools

to minimize the gap between specifications.

As formerly stated, this may reduce discussions and overhead when

contributing to the YP relating to recipes.

 

Carsten

 

Von: Martin Jansa <martin.jansa@...>
Gesendet: Montag, 13. März 2023 19:00
An: Alexander Kanavin <alex.kanavin@...>
Cc: embedded (VIVAVIS AG) <embedded@...>; yocto@...
Betreff: Re: [yocto] State of Yocto styleguide and oe-stylize.py script

 

On Mon, Mar 13, 2023 at 6:34 PM Alexander Kanavin <alex.kanavin@...> wrote:

There is not a lot of interest in maintaining style guides, and
associated tooling. My personal feeling is that they don't really help
with the truly problematic things in recipes that need a human eye (or
chatgpt level intelligence :) - by and large people do follow
reasonable order of entries for example, and nitpicking on an exact
order would just be wasting precious maintainer time.

 

I agree that there are other more important things, but I also like style (only in code - human looks are overrated :)).

 

If the tool is executed locally before sending the contribution (and Carsten does seem interested in doing just that - not asking Khem to run it on incoming patches) then I believe it can save maintainers time by sending better patches on first try not waste it and our styleguide really needs some TLC as Carsten found out.

 

The same does apply to e.g. scripts/contrib/patchreview.py.

 

If the missing/malformed Upstream-Status is reported to the original contributor before he/she/it sends the patch, by some at least well documented work flow how to submit patches, then it saves more maintainer time, than asking for it during e-mail review or worse after the change is merged or built by maintainer and QA check reports it's missing or malformed.

 

If someone is willing to help with the tooling, we should endorse that, not discourage them even when there are bigger-greater goals like yocto-check-layer script you mentioned.

 

Cheers,

 

If you want to ensure good quality, making your layer pass the yocto
compatibility script, and ensuring there are no warnings of any kind
from bitbake when built with latest master revisions of everything is
a better first step in my opinion.

Alex

On Mon, 13 Mar 2023 at 15:20, VIVAVIS AG via lists.yoctoproject.org
<embedded=vivavis.com@...> wrote:
>
> Hi,
>
> I'm wondering whether the styleguide www.openembedded.org/wiki/Styleguide,
> meta-openembedded/contrib/oe-stylize.py or none of them is the source of
> truth for writing a good recipe.
>
> E.g., if you run oe-stylize.py, the SRCREV variable is placed above SRC_URI,
> or RDEPENDS is placed above FILES, which is not what the Wiki documents.
> And there are more discrepancies of this type.
>
> Furthermore, the script doesn't know the FILESEXTRAPATHS variable in bbappend files
> and moves it to the end of my recipe. Well, this is not decribed in the Wiki, but a look
> into append files in meta-openembedded shows, that it is common pactice to put
> FILESEXTRAPATHS in the first line of the recipe.
>
> The Wiki has an interesting note and the end: "You can run contrib/oe-stylize.py from
> meta-oe on your recipes before submitting them; however it is not necessarily up-to-date
> with all current style conventions. This page should be considered the canonical reference."
>
> Furthermore, there's github.com/openembedded/meta-openembedded/pull/465
> providing another ruleset for the new linter.
>
> So, my question to the Yocto maintainers is, what is the current state of the styleguide
> and oe-stylize.py? Are there plans to synchronize them?
>
> Thanks for clarification.
>
> Carsten Stelling
>
>
>