[Surfraw-devel] Surfraw Style Guide RFC (was whitespace errors)
kyle at tyrfingr.is
Sat Oct 11 20:19:38 UTC 2014
Here's a first pass at a STYLE file.
On 10/10/2014 10:36 PM, Jason Ryan wrote:
> On 05/10/14 at 06:31pm, Jason Ryan wrote:
>> On 05/10/14 at 07:16am, Lucas Hoffmann wrote:
>>> Is there any style (guide?) set up for surfraw? The HACKING file says
>>>> You must call w3_global_usage at the end of this function and follow
>>>> the surfraw usage style least you be marked a quiche eater.
>>> But I'm not sure if that is meant for any general style.
>> Not that I am aware of; but we could certainly kick one off with this
>> My preferences would be:
>>> What I have seen:
>>> * different leading whitespace (4 spaces or tabs)
>> Non-committal but I think that tabs currently outweigh spaces
>>> * different process substitutions ( `` or $() )
>> Should use $(), it is *much* more legible
>>> * variables in functions declared local and not declared local
>> Declare local
>>> * initializing variables to the empty string with var= and var=""
>> The latter
>>> * long lines
>> Aim for 80, where reasonable
>>> * if ... then and for ... do on the same line and in different lines
>> Different lines
>> What do others think about a agreeing a style guide and then tidying up the code
>> to conform to it (if only so people don't have to wear the stigma of being a
>> quiche eater)?
> Any further suggestions? Or should I just write this up and it can be added to
> as and when it is needed?
> Surfraw-devel mailing list
> Surfraw-devel at lists.alioth.debian.org
-------------- next part --------------
____ _______ ___ _____
/ ___|_ _\ \ / / | | ____|
\___ \ | | \ V /| | | _|
___) || | | | | |___| |___
|____/ |_| |_| |_____|_____|
It's important to rage against the web in _style_. Fellow surfer,
take these guidelines with you when developing revolutionary elvi:
for something in stuff
for something in stuff ; do
if rage ;
if rage ; then
INITIALISING VARIABLES WITH AN EMPTY STRING
The var="" syntax is preferred over var=.
Revolutionary elvi are of greatest utility when they are readable. If
the consensus is that a breach of the style guide yields more readable
code, the more legible option should be chosen.
Tabs are preferred.
Lines should be wrapped at 80 characters so long as it doesn't require
absurd contortions to fit this.
LOCAL VARIABLE DECLARATION
Function variables should be defined local. What happens in the
function should stay in the function.
Use $() over `` for legibility.
This is generally frowned upon.
More information about the Surfraw-devel