WebKit Bugzilla
Attachment 362688 Details for
Bug 194930
: Codify the naming convention for fooIfExists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Updates the style guideline
bug-194930-20190221195335.patch (text/plain), 1.97 KB, created by
Ryosuke Niwa
on 2019-02-21 19:53:35 PST
(
hide
)
Description:
Updates the style guideline
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2019-02-21 19:53:35 PST
Size:
1.97 KB
patch
obsolete
>Index: Websites/webkit.org/ChangeLog >=================================================================== >--- Websites/webkit.org/ChangeLog (revision 241928) >+++ Websites/webkit.org/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2019-02-21 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Codify the naming convention for fooIfExists >+ https://bugs.webkit.org/show_bug.cgi?id=194930 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Updating the coding style guidleline after the discussion following >+ https://lists.webkit.org/pipermail/webkit-dev/2013-June/025056.html >+ >+ * code-style.md: >+ > 2019-02-20 Jon Davis <jond@apple.com> > > Added macOS Mojave builds to the WebKit Build Archives. >Index: Websites/webkit.org/code-style.md >=================================================================== >--- Websites/webkit.org/code-style.md (revision 241928) >+++ Websites/webkit.org/code-style.md (working copy) >@@ -676,6 +676,34 @@ bool convertToASCII(short*, size_t); > bool toASCII(short*, size_t); > ``` > >+[](#names-if-exists) The getter function for a member variable should not have any suffix or prefix indicating the function can optionally create or initialize the member variable. Suffix the getter function which does not automatically create the object with `IfExists` if there is a variant which does. >+ >+###### Right: >+ >+```cpp >+StyleResolver* styleResolverIfExists(); >+StyleResolver& styleResolver(); >+``` >+ >+###### Wrong: >+ >+```cpp >+StyleResolver* styleResolver(); >+StyleResolver& ensureStyleResolver(); >+``` >+ >+###### Right: >+ >+```cpp >+Frame* frame(); >+``` >+ >+###### Wrong: >+ >+```cpp >+Frame* frameIfExists(); >+``` >+ > [](#names-variable-name-in-function-decl) Leave meaningless variable names out of function declarations. A good rule of thumb is if the parameter type name contains the parameter name (without trailing numbers or pluralization), then the parameter name isn't needed. Usually, there should be a parameter name for bools, strings, and numerical types. > > ###### Right:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 194930
: 362688