Openembedded Core Discussions
 help / color / mirror / Atom feed
* recipe whitespace style questions
@ 2013-08-14 13:51 Peter A. Bigot
  2013-08-14 14:13 ` Martin Jansa
  0 siblings, 1 reply; 4+ messages in thread
From: Peter A. Bigot @ 2013-08-14 13:51 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

This maybe opens a can of worms, but:

A recent comment on a patch raised the issue of how to do whitespace 
indentation on multiple-line continuations: specifically, how many 
spaces should be used.  This is not addressed in the current style-guide 
and is something I've been confused about too.

I don't know that I particularly care which way it's done, but I would 
like guidance to help me be consistent for recipes I create.

Would a patch to update the style guide with clarifications be 
acceptable?  The intent of the proposed text below is to recommend:

SRC_URI = "file://skeleton \
            file://skeleton_test.c \
            file://COPYRIGHT \
            "

which should be displayed in a fixed-width font with the "file" words 
all aligned.

Next: I can find no documented recommendation in whether the closing 
quote is indented or not.  In addition to above (which in my display has 
the closing quote aligned with the letter 'f' of "file"; call this style 
"content aligned"), I've also seen:

SRC_URI = "file://skeleton \
            file://skeleton_test.c \
            file://COPYRIGHT \
           "

which I'll call "quote aligned", and:

SRC_URI = "file://skeleton \
            file://skeleton_test.c \
            file://COPYRIGHT \
"

which I'll call "none", and;

SRC_URI = "file://skeleton \
            file://skeleton_test.c \
            file://COPYRIGHT"

which I'll call "joined".

Again, for consistency's sake it would be nice to have a 
recommendation.  I personally prefer "none", which matches the closing 
bracket style for functions.

Next: I've also seen:

SRC_URI = " \
     file://skeleton \
     file://skeleton_test.c \
     file://COPYRIGHT \
"

which generalizes the Python 4-space indentation rule and is a nice 
option when the variable name is so long the content would go beyond 80 
characters if it appeared on the first line.

Finally, the use of tabs for shell functions is not preserved by 
meta-openembedded/contrib/oe-stylize.  Do any of the core developers 
recommend using that script, and if so does it need to be updated?  Do 
Yocto project coding standards apply to meta-openembedded?  And what 
about whitespace for multiple-line continuations within a shell 
function: one tab level?

If we can reach some level of consensus (or fiat) I'll prepare a patch 
for the style guide.  I think the following captures the proposed 
clarifications:

* Multiple-line continuations should be indented to the level of the 
content following the introductory quote symbol on the first line.

* Alternatively, the first line of a multi-line value may be continued 
after a single space following the introductory quote symbol and all 
subsequent content lines indented four spaces (or one tab if within a 
shell function)

*Any closing quote of a multiple-line continuation should be placed at 
the indentation level of the first continued line.

If you feel this is all too nit-picky just ignore it.

Peter



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-19 22:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-14 13:51 recipe whitespace style questions Peter A. Bigot
2013-08-14 14:13 ` Martin Jansa
2013-08-14 14:15   ` Chris Larson
     [not found]   ` <20130814143157.GB3894@windriver.com>
2013-08-19 22:57     ` Peter A. Bigot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox