Commit 0dd54ad2 authored by eric@webkit.org's avatar eric@webkit.org
Browse files

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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@51587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 285d949b
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:
2009-11-18 Eric Seidel <eric@webkit.org>
Reviewed by David Levin.
......
<?php
$title="WebKit Coding Style Guidelines";
include("../header.inc");
?>
$extra_head_content = <<<END
<style type="text/css">
pre .code {
background-color: #F2F2F2;
......@@ -18,6 +17,11 @@ pre .code {
</style>
END;
include("../header.inc");
?>
<h2>WebKit Coding Style Guidelines</h2>
<h3>Indentation</h3>
......@@ -701,11 +705,76 @@ Don't bother to organize them in a logical order.
</pre>
</ol>
<h3>"using namespace" Statements</h3>
<h3>"using" Statements</h3>
<ol>
<li>Do not use "using namespace" statements in header files.
<li>In header files, do not use "using" statements in global or
"namespace" scope.
<h4 class="right">Right:</h4>
<pre class="code">
// wtf/Vector.h
namespace WTF {
class VectorBuffer {
using std::min;
...
};
} // namespace WTF
</pre>
<h4 class="wrong">Wrong:</h4>
<pre class="code">
// wtf/Vector.h
namespace WTF {
using std::min;
class VectorBuffer {
...
};
} // namespace WTF
</pre>
</li>
<li>It is acceptable, however, to use "using" declarations at the end of
header files in the WTF sub-libary to include one or more names in
the WTF namespace into the global scope.
<h4 class="right">Right:</h4>
<pre class="code">
// wtf/Vector.h
namespace WTF {
} // namespace WTF
using WTF::Vector;
</pre>
<h4 class="wrong">Wrong:</h4>
<pre class="code">
// wtf/Vector.h
namespace WTF {
} // namespace WTF
using namespace WTF;
</pre>
<h4 class="wrong">Wrong:</h4>
<pre class="code">
// runtime/UString.h
namespace WTF {
} // namespace WTF
using WTF::PlacementNewAdopt;
</pre>
</li>
<li>Any "using namespace" statements for a nested namespace whose parent namespace
......
......@@ -20,9 +20,11 @@ Once you have the code <a href="/building/checkout.html">checked out</a>, <a hre
<h3>Code Style Guidelines</h3>
<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>.
There are some older parts of the codebase that do not always follow these guidelines. If you come across code like this,
it's generally best to clean it up to comply with the new guidelines.</p>
<p>Patches must comply with the <a href="/coding/coding-style.html">code style guidelines</a>.
Some older parts of the codebase do not follow these guidelines.
If you are modifying such code, it is generally best to clean it up
to comply with the current guidelines. An exception is legacy components,
which should not be cleaned up.</p>
<h3>Regression tests</h3>
<p>Once you have made your changes, you need to run the regression tests, which is done via the <tt>run-webkit-tests</tt> script.
......
......@@ -16,6 +16,11 @@ framework to better refactor code or to make simplifications that will help make
<dl>
<dt>Follow the Coding Style Guidelines</dt>
<dd>We welcome patches that clean up code to follow our coding style guidelines.
We especially encourage contributors to clean up code that they are already
working on. It is less common for contributors to update style without
making substantive changes. If you would like to clean up code without
making substantive changes, you are advised to check with project members
first.</dd>
<dt>Eliminate Redundant Code in WebKit and WebCore</dt>
<dd>Now that WebKit and WebCore are both open source, there is less of a need for an artificial barrier between the two frameworks. Much of the Objective-C code that
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment