Indentation in stdlib

P

Philipp Kempgen

Annoyed about inconsistent indentation in some files in the stdlib
(e.g. ipaddr.rb) ...

Sometimes 4 indentations are written as 8 spaces and sometimes (in the
same file) as 1 tab.

Example:

def initialize(addr = '::', family = Socket::AF_UNSPEC)
if !addr.kind_of?(String)
case family
when Socket::AF_INET, Socket::AF_INET6
set(addr.to_i, family)
@mask_addr = (family == Socket::AF_INET) ? IN4MASK : IN6MASK
return
^spaces
when Socket::AF_UNSPEC
^spaces
raise ArgumentError, "address family must be specified"
^tab
else
^spaces
raise ArgumentError, "unsupported address family: #{family}"
^tab
end
end

It happens to look OK if and only if your tab-width is set to 8.
Otherwise a mix of spaces and tabs looks totally unreadable.

I have a preference for 1 tab (without expansion) per indentation
(so everybody can set the tab-width according to their personal
liking) but I'm fine with a fixed number of spaces per indentation.

However a mix of spaces and tabs is the worst of both ways.
Just saying ... No offense.


Philipp
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,059
Latest member
cryptoseoagencies

Latest Threads

Top