[Nfd-dev] Code formatter/beautifier

Wentao Shang wentaoshang at ucla.edu
Thu Nov 3 11:06:18 PDT 2016


> On Nov 3, 2016, at 11:47 AM, Junxiao Shi <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
> 
> _______________________________________________
> Nfd-dev mailing list
> Nfd-dev at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/nfd-dev





More information about the Nfd-dev mailing list