OLD | NEW |
1 title=Coding Style | 1 title=Coding Style |
2 | 2 |
3 | 3 |
4 <h2 id="precedence">{{s1 Precedence}}</h2> | 4 <h2 id="precedence">{{s1 Precedence}}</h2> |
5 | 5 |
6 <p>{{s2 The Adblock Plus coding style is based on others. Our rules (both genera
l and language specific) always overrule referenced style guides. The language s
pecific sections overrule the general section.}}</p> | 6 <p>{{s2 The Adblock Plus coding style is based on others. Our rules (both genera
l and language specific) always overrule referenced style guides. The language s
pecific sections overrule the general section.}}</p> |
7 | 7 |
8 <h2 id="consistency">{{s3 Consistency}}</h2> | 8 <h2 id="consistency">{{s3 Consistency}}</h2> |
9 | 9 |
10 <p>{{s4 Consistency is most important: Be consistent within functions, files, mo
dules and projects. Making existing code conform with this style guide is fine,
but it should happen in dedicated commits, preferably for a whole module or proj
ect at once.}}</p> | 10 <p>{{s4 Consistency is most important: Be consistent within functions, files, mo
dules and projects. Making existing code conform with this style guide is fine,
but it should happen in dedicated commits, preferably for a whole module or proj
ect at once.}}</p> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 </ul> | 43 </ul> |
44 | 44 |
45 <h2 id="html-css">{{html-css HTML and CSS}}</h2> | 45 <h2 id="html-css">{{html-css HTML and CSS}}</h2> |
46 <ul> | 46 <ul> |
47 <li>{{html-css-general Follow the <a href="https://google.github.io/styleguide
/htmlcssguide.html">Google HTML/CSS Style Guide</a>.}}</li> | 47 <li>{{html-css-general Follow the <a href="https://google.github.io/styleguide
/htmlcssguide.html">Google HTML/CSS Style Guide</a>.}}</li> |
48 <li>{{html-css-quotation Use double over single quotation marks.}}</li> | 48 <li>{{html-css-quotation Use double over single quotation marks.}}</li> |
49 <li>{{html-css-optional-tag Don't omit optional HTML tags.}}</li> | 49 <li>{{html-css-optional-tag Don't omit optional HTML tags.}}</li> |
50 <li>{{html-css-hexadecimal CSS color values should be specified in hexadecimal
where possible.}}</li> | 50 <li>{{html-css-hexadecimal CSS color values should be specified in hexadecimal
where possible.}}</li> |
51 <li>{{html-css-shorthand CSS shorthand properties usage is optional.}}</li> | 51 <li>{{html-css-shorthand CSS shorthand properties usage is optional.}}</li> |
52 <li>{{html-css-order CSS rule declaration order should follow the <a href="htt
ps://make.wordpress.org/core/handbook/best-practices/coding-standards/css/#prope
rty-ordering">WordPress CSS Coding Standards</a>.}}</li> | 52 <li>{{html-css-order CSS rule declaration order should follow the <a href="htt
ps://make.wordpress.org/core/handbook/best-practices/coding-standards/css/#prope
rty-ordering">WordPress CSS Coding Standards</a>.}}</li> |
53 <li>{{html-css-units CSS number values should specify units where possible.}}<
/li> | |
54 <li>{{html-css-leading-zero Don't omit the optional leading 0 for decimal numb
ers.}}</li> | 53 <li>{{html-css-leading-zero Don't omit the optional leading 0 for decimal numb
ers.}}</li> |
| 54 <li>{{html-css-single-line CSS declaration blocks with a single selector and a
single rule can be written in a single line.}}</li> |
55 </ul> | 55 </ul> |
56 | 56 |
57 <h2 id="python">{{s19 Python}}</h2> | 57 <h2 id="python">{{s19 Python}}</h2> |
58 <ul> | 58 <ul> |
59 <li>{{python-general Follow <a href="https://www.python.org/dev/peps/pep-0008/
"><fix>PEP-8</fix></a> and the recommendations in the offical <fix>Python</fix>
documentation.}}</li> | 59 <li>{{python-general Follow <a href="https://www.python.org/dev/peps/pep-0008/
"><fix>PEP-8</fix></a> and the recommendations in the offical <fix>Python</fix>
documentation.}}</li> |
60 <li>{{python-version Make the code compatible with both <fix>Python 2.7</fix>
and <fix>Python 3.5+</fix> (see <a href="https://docs.python.org/dev/howto/pypor
ting.html">this guide</a>). Use <a href="https://docs.python.org/2/library/__fut
ure__.html"><fix>__future__</fix> imports</a> to address syntactic differences b
ut avoid <a href="https://pythonhosted.org/six/"><fix>six</fix></a>, <a href="ht
tp://python-future.org/compatible_idioms.html"><fix>python-future</fix></a>, etc
. to not introduce additional dependencies.}}</li> | 60 <li>{{python-version Make the code compatible with both <fix>Python 2.7</fix>
and <fix>Python 3.5+</fix> (see <a href="https://docs.python.org/dev/howto/pypor
ting.html">this guide</a>). Use <a href="https://docs.python.org/2/library/__fut
ure__.html"><fix>__future__</fix> imports</a> to address syntactic differences b
ut avoid <a href="https://pythonhosted.org/six/"><fix>six</fix></a>, <a href="ht
tp://python-future.org/compatible_idioms.html"><fix>python-future</fix></a>, etc
. to not introduce additional dependencies.}}</li> |
61 <li>{{python-strings Write string literals so that they match the behaviour of
<a href="https://docs.python.org/3/library/functions.html#ascii"><code><fix>asc
ii()</fix></code></a>, i.e. use single quotes except to avoid escaping of embedd
ed quotes and use <code><fix>\u</fix></code> escapes for non-ascii characters bu
t don't prefix strings with <code><fix>u</fix></code>. For docstrings, however,
follow <a href="https://www.python.org/dev/peps/pep-0257/">PEP-257</a>.}}</li> | 61 <li>{{python-strings Write string literals so that they match the behaviour of
<a href="https://docs.python.org/3/library/functions.html#ascii"><code><fix>asc
ii()</fix></code></a>, i.e. use single quotes except to avoid escaping of embedd
ed quotes and use <code><fix>\u</fix></code> escapes for non-ascii characters bu
t don't prefix strings with <code><fix>u</fix></code>. For docstrings, however,
follow <a href="https://www.python.org/dev/peps/pep-0257/">PEP-257</a>.}}</li> |
62 <li>{{python-prefix In modules, prefix private functions and variables with a
single underscore.}}</li> | 62 <li>{{python-prefix In modules, prefix private functions and variables with a
single underscore.}}</li> |
63 <li>{{python-concatenation Use the <code><fix>+</fix></code> operator when con
catenating exactly two strings, use the <a href="https://docs.python.org/2/libra
ry/stdtypes.html#str.format"><code><fix>format()</fix></code> method</a> for mor
e complex string formatting, use the <a href="https://docs.python.org/2/library/
stdtypes.html#str.join"><code><fix>join()</fix></code> method</a> when concatena
ting pre-existing sequences.}}</li> | 63 <li>{{python-concatenation Use the <code><fix>+</fix></code> operator when con
catenating exactly two strings, use the <a href="https://docs.python.org/2/libra
ry/stdtypes.html#str.format"><code><fix>format()</fix></code> method</a> for mor
e complex string formatting, use the <a href="https://docs.python.org/2/library/
stdtypes.html#str.join"><code><fix>join()</fix></code> method</a> when concatena
ting pre-existing sequences.}}</li> |
64 <li>{{python-tuple-vs-list Use tuples for data that have structure, use lists
for data that have order.}}</li> | 64 <li>{{python-tuple-vs-list Use tuples for data that have structure, use lists
for data that have order.}}</li> |
(...skipping 30 matching lines...) Expand all Loading... |
95 <ul> | 95 <ul> |
96 <li>{{objc-conventions Follow Apple's <a href="https://developer.apple.com/lib
rary/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Conventions/Co
nventions.html">conventions</a>}}.</li> | 96 <li>{{objc-conventions Follow Apple's <a href="https://developer.apple.com/lib
rary/ios/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Conventions/Co
nventions.html">conventions</a>}}.</li> |
97 </ul> | 97 </ul> |
98 | 98 |
99 <h2 id="puppet">{{s31 Puppet}}</h2> | 99 <h2 id="puppet">{{s31 Puppet}}</h2> |
100 <ul> | 100 <ul> |
101 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht
ml">Puppet Style Guide</a>.}}</li> | 101 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht
ml">Puppet Style Guide</a>.}}</li> |
102 <li>{{s33 Opening braces don't go on their own line.}}</li> | 102 <li>{{s33 Opening braces don't go on their own line.}}</li> |
103 <li>{{s34 Arrows should not be aligned.}}</li> | 103 <li>{{s34 Arrows should not be aligned.}}</li> |
104 </ul> | 104 </ul> |
OLD | NEW |