From: Aaron Patterson Date: 2010-08-17T10:15:40+09:00 Subject: Re: Indentation in stdlib --RASg3xLB4tUQ4RcS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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) ... >=20 > Sometimes 4 indentations are written as 8 spaces and sometimes (in the > same file) as 1 tab. >=20 > Example: >=20 > def initialize(addr =3D '::', family =3D Socket::AF_UNSPEC) > if !addr.kind_of?(String) > case family > when Socket::AF_INET, Socket::AF_INET6 > set(addr.to_i, family) > @mask_addr =3D (family =3D=3D 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 >=20 > 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. >=20 > 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. >=20 > However a mix of spaces and tabs is the worst of both ways. > Just saying ... No offense. 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 --=20 Aaron Patterson http://tenderlovemaking.com/ --RASg3xLB4tUQ4RcS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) iQEcBAEBAgAGBQJMaeIQAAoJEJUxcLy0/6/GYHgH+gLSaO3ncB7wq3HAEhtHmUhg aJSEvDzOYckzZTUI/3dwOdRhI7Tk9/U2OTK1y257bYlUJH9VbG1KeMhpZoghaUd4 yuFyh3Ukdt1/X40sJbAQCcx5IOtyeQT8fBKpYj8sFvQdiSYyhR2ipPB+8wyqPMUZ OIo8G1TfKl/RBIn1EObFWq2Vo68+hSTAF9+kwTmkvgN6XdXi45aj/df+UgU5Lbs4 ycZID2oE1xoqrC9AJxOhLCbXoZc5C9p4yAkklHP2yapbl1oWzUA7Sgum7ZNyTmn2 2Wu8L3VW2UisPHqkaYlDHqekaTUAC13hGqXXy/07SE+23cqEKUAiugmqff1bahs= =r76c -----END PGP SIGNATURE----- --RASg3xLB4tUQ4RcS--