Changeset 51587 in webkit


Ignore:
Timestamp:
Dec 1, 2009 9:51:15 PM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-01 Chris Jerdonek <chris.jerdonek@gmail.com>

Reviewed by Darin Adler.

Added clarifications to the web site regarding coding style and
code cleanup--

https://bugs.webkit.org/show_bug.cgi?id=31618

Changes include the following:

  • Expanded the style guidelines regarding "using" statements.
  • Made the style guidelines page validate as HTML.
  • Added that legacy WebKit components should not be cleaned up.
  • Added that it is more acceptable to update style when already touching code.
  • coding/coding-style.html:
  • coding/contributing.html:
  • projects/cleanup/index.html:
Location:
trunk/WebKitSite
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitSite/ChangeLog

    r51152 r51587  
     12009-12-01  Chris Jerdonek  <chris.jerdonek@gmail.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Added clarifications to the web site regarding coding style and
     6        code cleanup--
     7
     8        https://bugs.webkit.org/show_bug.cgi?id=31618
     9
     10        Changes include the following:
     11
     12        - Expanded the style guidelines regarding "using" statements.
     13        - Made the style guidelines page validate as HTML.
     14        - Added that legacy WebKit components should not be cleaned up.
     15        - Added that it is more acceptable to update style when already
     16          touching code.
     17
     18        * coding/coding-style.html:
     19        * coding/contributing.html:
     20        * projects/cleanup/index.html:
     21
    1222009-11-18  Eric Seidel  <eric@webkit.org>
    223
  • trunk/WebKitSite/coding/coding-style.html

    r50978 r51587  
    11<?php
    22    $title="WebKit Coding Style Guidelines";
    3     include("../header.inc");
    4 ?>
    5 
     3   
     4    $extra_head_content = <<<END
    65<style type="text/css">
    76pre .code {
     
    1817</style>
    1918
     19
     20END;
     21
     22    include("../header.inc");
     23?>
    2024
    2125<h2>WebKit Coding Style Guidelines</h2>
     
    702706</ol>
    703707
    704 <h3>"using namespace" Statements</h3>
     708<h3>"using" Statements</h3>
    705709
    706710<ol>
    707711
    708 <li>Do not use "using namespace" statements in header files.
     712<li>In header files, do not use "using" statements in global or
     713"namespace" scope.
     714
     715<h4 class="right">Right:</h4>
     716<pre class="code">
     717// wtf/Vector.h
     718
     719namespace WTF {
     720
     721class VectorBuffer {
     722    using std::min;
     723    ...
     724};
     725
     726} // namespace WTF
     727</pre>
     728<h4 class="wrong">Wrong:</h4>
     729<pre class="code">
     730// wtf/Vector.h
     731
     732namespace WTF {
     733
     734using std::min;
     735   
     736class VectorBuffer {
     737    ...
     738};
     739
     740} // namespace WTF
     741</pre>
     742</li>
     743
     744<li>It is acceptable, however, to use "using" declarations at the end of
     745header files in the WTF sub-libary to include one or more names in
     746the WTF namespace into the global scope.
     747
     748<h4 class="right">Right:</h4>
     749<pre class="code">
     750// wtf/Vector.h
     751
     752namespace WTF {
     753
     754} // namespace WTF
     755
     756using WTF::Vector;
     757</pre>
     758<h4 class="wrong">Wrong:</h4>
     759<pre class="code">
     760// wtf/Vector.h
     761
     762namespace WTF {
     763
     764} // namespace WTF
     765
     766using namespace WTF;
     767</pre>
     768<h4 class="wrong">Wrong:</h4>
     769<pre class="code">
     770// runtime/UString.h
     771
     772namespace WTF {
     773
     774} // namespace WTF
     775
     776using WTF::PlacementNewAdopt;
     777</pre>
    709778</li>
    710779
  • trunk/WebKitSite/coding/contributing.html

    r49606 r51587  
    2121
    2222<h3>Code Style Guidelines</h3>
    23 <p>In order for your patch to be landed, it's necessary that it comply to the <a href="/coding/coding-style.html">code style guidelines</a>.
    24 There are some older parts of the codebase that do not always follow these guidelines. If you come across code like this,
    25 it's generally best to clean it up to comply with the new guidelines.</p>
     23<p>Patches must comply with the <a href="/coding/coding-style.html">code style guidelines</a>.
     24Some older parts of the codebase do not follow these guidelines.
     25If you are modifying such code, it is generally best to clean it up
     26to comply with the current guidelines. An exception is legacy components,
     27which should not be cleaned up.</p>
    2628
    2729<h3>Regression tests</h3>
  • trunk/WebKitSite/projects/cleanup/index.html

    r16492 r51587  
    1717<dt>Follow the Coding Style Guidelines</dt>
    1818<dd>We welcome patches that clean up code to follow our coding style guidelines.
     19We especially encourage contributors to clean up code that they are already
     20working on. It is less common for contributors to update style without
     21making substantive changes. If you would like to clean up code without
     22making substantive changes, you are advised to check with project members
     23first.</dd>
    1924
    2025<dt>Eliminate Redundant Code in WebKit and WebCore</dt>
Note: See TracChangeset for help on using the changeset viewer.