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
(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