[typo] A matter of style

Piers Cawley pdcawley at bofh.org.uk
Tue Sep 27 13:13:29 EDT 2005

"William A. Carrel" <william.a at carrel.org> writes:

> On Sep 27, 2005, at 5:30 AM, Piers Cawley wrote:
>> I've been working on typo and I'm finding the style guidelines  
>> suggested on
>> trac rather insufficient. Have we got definitive rulings how we  
>> deal with
>> breaking long lines (for instance)?
> I've found that a lot of the long lines aren't broken at all.  Not my  
> first choice, but then I like parenthesis around an arg list longer  
> than one or two items as well. ;-)

Yeah, but then I like rectangular arg blocks when they're parenthesized

  object.method(arg1, arg2, arg3,
                arg4, arg5, arg6)

Which doesn't do much for shortening lines.

  object \
    .method(arg1, arg2, arg3, arg4, arg5, arg6)

Might be the way forward (and it echo's Kent Beck's Smalltalk Best Practice
patterns for indenting, which doesn't hurt). 

> Just to back this up with facts...
> % grep -rE '^.{80,}$' . | wc -l            ~/Projects/typo-local
>      3135
> That's the number of lines with 80 or more characters on them in the  
> typo source out of 36k or so total lines.

Yipe. So that's nearly 10%. I wonder what fixing that'll do to rake stats?

> But yes, if this is going to be the practice, it should be spelled  
> out explicitly on the CodingStyle wiki page.

Indeed. My gut feeling is a 'soft' 80 character margin is the way to go. I
don't suppose there's a RubyTidy akin to PerlTidy? Or can GNU indent handle
Ruby source?

Piers Cawley <pdcawley at bofh.org.uk>

More information about the Typo-list mailing list