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
Probably this is by accident. If you check the code style in the wiki,
it says Ruby stdlib should be 2 space indent:
http://redmine.ruby-lang.org/wiki/ruby/DeveloperHowTo
···
On Tue, Aug 17, 2010 at 05:08:31AM +0900, Philipp Kempgen wrote:
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.
--
Aaron Patterson
http://tenderlovemaking.com/