From kde-core-devel Mon Feb 12 22:45:47 2007 From: Urs Wolfer Date: Mon, 12 Feb 2007 22:45:47 +0000 To: kde-core-devel Subject: Re: kdelibs coding style Message-Id: <200702122345.47573.uwolfer () kde ! org> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=117132034926671 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--nextPart4264773.iDhX950j4F" --nextPart4264773.iDhX950j4F Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline =46irst of all, I'm aware of the age of this thread. But nothing has change= d=20 since then. That's why I'm writing again about this issue. The opinion of a lot of the developers who have commented this thread has=20 been that there should be at least coding formation conventions at least fo= r=20 kdelibs. The "older" files of kdelibs are quite messy in formatting. Zack proposed to do no mass formatting of kdelibs. He proposed to format th= e=20 files, which are edited in any way by a developer. But to be honest: Who ha= s=20 done that? People change some lines, but nobody cares about the formating. IMHO we should act now. My proposal: * update the Library Code Policy [1] with the example by Zack. The example = is=20 the Trolltech Qt Coding Style. That means we follow at least in kdelibs our= =20 underlying library in formatting. * run astyle [2] over kdelibs trunk. I have tested that [3] and the result = is=20 quite good and follows the style described above. Try it! Problems: * branches: we have problem to merge them back (->conflicts) solution: run over astyle as described above before merging * local modifications: same solution as branches * svn blame: reformated lines don't show the "right" revision and author. B= UT:=20 the same would happen when we format every single file when we edit it=20 anyways. If we would like to have "nicer" code, there is no way around that= =20 issue. I would be volunteer to do the steps described above. Bye urs [1] http://developernew.kde.org/Policies/Library_Code_Policy [2] http://astyle.sourceforge.net/ [3]=20 astyle --indent=3Dspaces=3D4 --brackets=3Dlinux --indent-labels --pad=3Dope= r --unpad=3Dparen --one-line=3Dkeep-statements --convert-tabs --indent-prep= rocessor=20 `find -type f -name '*.cpp'` `find -type f -name '*.h'` On Thursday 01 January 1970, Zack Rusin wrote:=20 > With much love from Russia comes temperature checker (prediction: it's > hot! flaming hot!) in the form of a proposal for a common coding style > in kdelibs. > > It's something we talked about during the KDE Four meeting. The reason > for it is that it's a pain in a butt to read through kdelibs code. > Indention differs within files which makes a lot of them unreadable > (oh, and btw shoutouts to George and Lubos for having indention styles > that make grown may cry and baby jesus swear). Since KDE uses this > thing called Qt, which also happens to be a library, it was agreed that > it makes natural sense to adopt the style used in Qt. Attached is a > file which describes Qt coding style. The idea is that it would be > adopted for kdelibs. > > To make it clear, no mass reindenting would take place.. For already > existing code the indention would be changed when a person would be > editting it. So if you fix a bug in already existing code, you simply > indent your code with the standard indention. This way history won't be > messed up and we'll end up with consistant style in all files by the > time KDE4 is out. The style is obviously mandatory for all new files. > > No exceptions. Either everything or nothing. > > Well, the only exception are libraries that are not maintained in the > KDE SVN (for example, if it ever happens, integrated KHTML/WebKit would > be maintained outside KDE SVN and the coding style that applies to it > is one chosen for this project - interestingly enough WebKit coding > style is basically exactly like Qt coding style so that's not going to > be an issue). > > Oh, and this is of course only for kdelibs, in your apps/modules you can > still use the 2.3 tabs indention or whatever your sick mind desires. > > with not a whole lot love but a lot of perseverance > your boy toy --nextPart4264773.iDhX950j4F Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQBF0O4booBDqI2Jn8gRAlu3AJ45GSPjuf10UGsmNJStY4sYoMQsegCfd+EC Up2RSsILi4+A2uPd0XzTSgo= =/Gei -----END PGP SIGNATURE----- --nextPart4264773.iDhX950j4F--