On Thu, Dec 19, 2013 at 01:20:41AM -0800, Andrea Marchesini wrote:
> Hi,
> 
> Writing a patch for bug 949488 I had to indent this piece of code: 
> 
>   nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
>   if (NS_WARN_IF(NS_FAILED(ssm->GetSimpleCodebasePrincipal(
>                                        originURI,
>                                        getter_AddRefs(providedPrincipal))))) {
> 
> It seems that our style guide does not say anything about how indent this 
> tricky case.
> So, talking with bholley we decided to write an email proposing something 
> like this:
> 
> 1. if they can, all the params on the same line. max 80 chars.
> 
> 2. otherwise multiple lines, aligned with the beginning of the params list.
> 
> es: obj->ThisIsALooooooooooongNameMethod(looooooooongParam1,
>                                          loooooooooogParam2);
> 
> 3. if 1 param alone goes over 80chars, it must be aligned in order to stay in 
> the 80chars and the rest of the params must be aligned with it.
> 
>   nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
>   if (NS_WARN_IF(NS_FAILED(ssm->GetSimpleCodebasePrincipal(
>                                        originURI,
>                                        getter_AddRefs(providedPrincipal))))) {
>                                                              // 80chars here ^
> 
> This approach is already used in dom/workers and IndexedDB.
> https://mxr.mozilla.org/mozilla-central/source/dom/workers/RuntimeService.cpp#1647
> 
> How does it sound?

How about we just use clang-format?
http://www.irill.org/videos/euro-llvm-2013/jasper-hires.webm

Mike
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to