trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: December 2014

Re: [trinity-devel] Codebase formatting discussion

From: "Timothy Pearson" <kb9vqf@...>
Date: Tue, 30 Dec 2014 22:02:40 -0600
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA224

> On 12/31/2014 06:51 AM, Timothy Pearson wrote:
>> All,
>>
>> This is a follow-up on point #5 from my post earlier this month entitled
>> "TDE GIT thaw, build farm status, and
>> future direction".
>>
>>> Codebase formatting.  While this is not a major problem for the users I
>>> have been tripped up more than once by
>>> the fact that some portions of the codebase (twin among others) use a
>>> vastly different style of indentation and
>>> bracing, one that is (IMHO) extremely hard to read and/or modify.  This
>>> in turn has therefore contributed to many
>>> "fix up prior commit" commits and/or outright regressions in GIT.  I
>>> greatly prefer Stroustrup style formatting
>>> with hard tab indentation (no space or combined space/tab indents) and
>>> indented public/protected/private blocks.
>>> This style is highly legible, emphasizes the control flow, and produces
>>> a minimal number of non-whitespace
>>> difference lines when an if/else block is modified.  All of the new
>>> code (thousands and thousands of lines of
>>> it) that I have contributed to TDE have been in this style.  I have
>>> been toying with reformatting the entire TDE
>>> codebase in one large commit; if there are no objections I think this
>>> step could greatly improve both our
>>> development speed and the overall quality of the codebase; comments and
>>> discussion are welcome.
>>
>> I would like to start converting over the codebase ASAP.  I have an
>> automated tool that will do this, but would
>> like some feedback on the style to convert into as reformatting like
>> this is a one-time operation that will not be
>> repeated for the life of the TDE project.
>>
>> As mentioned above I strongly prefer a modified Stroustrup style
>> formatting.  Is this acceptable to the other
>> developers, and if not, what would you rather use and why?
>>
>> Thanks!
>>
>> Tim
>>
>
> Hi Tim, code reformatting is definitely something we have to do. I meant
> to come back with some style ideas/rules last
> week but other things got into the way. Can you give me a few more days
> (say until Monday) to come back with my thought?
> In the mean time, I think it would be useful if you share a small piece of
> code showing the code formatting that you
> are thinking about.
> Since the code reformatting is a "one time op", we should make sure we are
> all happy with the code style we choose.
> Obviously this will require some compromise from each of us, since every
> one has its own preferences about style.
>
> Cheers
>   Michele

Yes, we can wait a few days for your input. :-)

The vast majority of this file was written in the style I prefer:
https://git.trinitydesktop.org/cgit/tdelibs/tree/tdecore/tdehw/tdehardwaredevices.cpp?id=f27e71dcb162e37234ea98570379f60f8afdd8ea

I noticed on quick glance that at least one alternate styles snuck in over
time, so the revision ID specified in that link is an older version
without many of the changes that introduced those alternate styles.

I find it very easy to read on mutiple screens, on the Web and in Kate,
from small laptops up to my main workstation.  Comments are of course
welcome!

Tim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iFYEARELAAYFAlSjdV8ACgkQLaxZSoRZrGEH8wDdEve903mvhBoEpP5t5j/AZMRC
gZ8kAlfAEe3NXwDff5O8yguXqRoWrmwMI8EbU8BfNx7fhmaKGYArIg==
=1a3o
-----END PGP SIGNATURE-----