[OE-core] Yocto style guide change proposal

Martin Jansa martin.jansa at gmail.com
Fri Jul 20 15:17:51 UTC 2012


On Fri, Jul 20, 2012 at 02:56:01PM +0100, Richard Purdie wrote:
> On Fri, 2012-07-20 at 11:32 +0200, Martin Jansa wrote:
> > Now we have horrible mixture of whitespaces (tabs and space) only in 
> > recipe files, because yocto style guide recommends tabs in shell
> > functions. So if recipe has e.g. do_install_append as well as
> > populate_packages_prepend (not so uncommon combination as tabs fixing
> > patches show), then according to yocto style guide it should look like
> > this:
> > 
> > do_install_append() {
> > 	foo
> > }
> > python populate_packages_prepend () {
> >     libdir = bb.data.expand('${libdir}', d)
> >     do_split_packages(d, libdir, '^lib(.*)\.so\.*', 'lib%s', 'ORC %s library', extra_depends='', allow_links=True)
> > }
> > 
> > especially with default tab width 8 spaces it's ugly and because it
> > is inconsistent, many devs used spaces in shell functions too. Now when
> > someone accidentaly use tab also in python function it will show warning
> > or fail to parse. Some devs are using mix of tabs and spaces even on the
> > same line (e.g. to indent SRC_URI multiline entries).
> 
> We've said tabs for shell functions for *years*. I'm sure if I were to
> look at the mailing list archives, that would be clear.

Is new developer supposed to read all mailing list archives few years
back? Or can we assume that he will google for style guide? Note about
tabs was added to yocto style guide by Saul 21:05, 7 April 2011 and even
now it says:
"Use spaces for indentation as developers tends to use different amount
of spaces per one tab."
So tabs should be used already only in shell tasks, not for multiline
variables etc..

Not sure if it's worth your time trying to find it in archive..

> In summary, I agree we need to make the style guides consistent and have
> one version of them. I disagree with spaces for everything though,m
> particularly as we have said to use tabs for as long and many of the
> recipes do this (certainly more than use spaces).

If someone is using 4 spaces everywhere, then he wont probably make
mistake by using anything else then 4 spaces in python tasks where it
matters.

Regards,

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa at gmail.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20120720/ccf5f189/attachment-0002.sig>


More information about the Openembedded-core mailing list