[Nfd-dev] Code formatter/beautifier

Spyridon (Spyros) Mastorakis mastorakis at CS.UCLA.EDU
Thu Nov 3 11:09:00 PDT 2016


I agree with Wentao. The auto-formatting script should be triggered when you push a commit for code review. We cannot ask people to memorize all the coding style rules.

Spyros

Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/ <http://cs.ucla.edu/~mastorakis/>
Internet Research Laboratory
Computer Science Department
UCLA

> On Nov 3, 2016, at 11:06 AM, Wentao Shang <wentaoshang at ucla.edu> wrote:
> 
>> 
>> On Nov 3, 2016, at 11:47 AM, Junxiao Shi <shijunxiao at email.arizona.edu <mailto:shijunxiao at email.arizona.edu>> wrote:
>> 
>> Hi Nick
>> 
>> I heard there are someone using clang-format, but I haven't heard anyone being able to create a clang-format configuration that ensures 100% compliance.
>> Thus, I still recommend developers to memorize all style rules and ensure compliance the moment you type it.
>> 
>> I heard from a Google engineer that they use Eclipse to ensure Google code style compliance. I'm unsure whether it's possible with ndn-cxx rules.
> 
> Inside Google, the auto-formatting tool is integrated into all the source control tools and text editors. You can either do “git clang-format” before you push, or (more preferably) add a hook to your emacs/vim editor that formats the code automatically on save. As a lazy person, I highly recommend the second approach, provided that we can patch clang to support our formatting rules in ndn-cxx.
> 
> Wentao
> 
>> 
>> ndnSIM has defined their rules in terms of a particular clang-format configuration, which could be a solution. However, relying on a tool as the rules is similar to defining a network protocol in terms of a specific implementation, which could cause inter-operability problems.
>> 
>> Yours, Junxiao
>> From: Nick Gordon
>> Sent: ‎11/‎3/‎2016 11:36
>> To: Junxiao Shi
>> Subject: Code formatter/beautifier
>> 
>> Junxiao,
>> 
>> In an attempt to smooth out style issues, I intend to use a formatter. 
>> It appears that there is a well-known program, "clang-format", that does 
>> this. Do you have any system that you use to format your code that I 
>> should know about?
>> 
>> -Nick
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/nfd-dev/attachments/20161103/83ae9c20/attachment.html>


More information about the Nfd-dev mailing list