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> |
11 | 11 |
12 <h2 id="general">{{s5 General}}</h2> | 12 <h2 id="general">{{s5 General}}</h2> |
13 <ul> | 13 <ul> |
14 <li>{{s6 Follow the Mozilla Coding Style's <a href="https://developer.mozilla.
org/en-US/docs/Developer_Guide/Coding_Style#General_C.2FC.2B.2B_Practices">gener
al practices</a> and its <a href="https://developer.mozilla.org/en-US/docs/Devel
oper_Guide/Coding_Style#Naming_and_Formatting_code">naming and formatting rules<
/a>.}}</li> | 14 <li>{{s6 Follow the Mozilla Coding Style's <a href="https://developer.mozilla.
org/en-US/docs/Developer_Guide/Coding_Style#General_C.2FC.2B.2B_Practices">gener
al practices</a> and its <a href="https://developer.mozilla.org/en-US/docs/Devel
oper_Guide/Coding_Style#Naming_and_Formatting_code">naming and formatting rules<
/a>.}}</li> |
15 <li>{{s8 All files should have a <a href="license-headers">license header</a>,
but no mode line comments.}}</li> | 15 <li>{{s8 All files should have a <a href="license-headers">license header</a>,
but no mode line comments.}}</li> |
16 <li>{{s9 Newline at end of file, otherwise no trailing whitespace.}}</li> | 16 <li>{{s9 Newline at end of file, otherwise no trailing whitespace.}}</li> |
17 <li>{{s10 Lines can be longer than the limit, if limiting line length would hu
rt readability in a particular case.}}</li> | 17 <li>{{s10 Lines can be longer than the limit, if limiting line length would hu
rt readability in a particular case.}}</li> |
18 <li>{{s11 Opening braces always go on their own line.}}</li> | 18 <li>{{s11 Opening braces always go on their own line.}}</li> |
19 <li>{{s12 No hungarian notation, no special variable name prefixes or suffixes
denoting type or scope. All variable names start with a lower case letter.}}</l
i> | 19 <li>{{s12 No hungarian notation, no special variable name prefixes or suffixes
denoting type or scope. All variable names start with a lower case letter.}}</l
i> |
20 <li>{{s13 Don't comment code out, delete it.}}</li> | 20 <li>{{s13 Don't comment code out, delete it.}}</li> |
21 <li>{{todo-comments Don't add TODO comments, create an <a href="https://issues
.adblockplus.org">issue</a> and reference it in a comment instead.}}</li> | 21 <li>{{todo-comments Don't add TODO comments, create an <a href="https://issues
.adblockplus.org">issue</a> and reference it in a comment instead.}}</li> |
| 22 <li>{{zopflipng Always optimize PNG images using <a href="https://github.com/g
oogle/zopfli/blob/master/README.zopflipng">ZopfliPNG</a>.}}</li> |
22 </ul> | 23 </ul> |
23 | 24 |
24 <h2 id="javascript">{{s14 JavaScript}}</h2> | 25 <h2 id="javascript">{{s14 JavaScript}}</h2> |
25 <ul> | 26 <ul> |
26 <li>{{s15 Follow the Mozilla Coding Style's <a href="https://developer.mozilla
.org/en-US/docs/Developer_Guide/Coding_Style#JavaScript_practices">JavaScript pr
actices</a>.}}</li> | 27 <li>{{s15 Follow the Mozilla Coding Style's <a href="https://developer.mozilla
.org/en-US/docs/Developer_Guide/Coding_Style#JavaScript_practices">JavaScript pr
actices</a>.}}</li> |
27 <li>{{javascript-strict Always use <a href="https://developer.mozilla.org/docs
/Web/JavaScript/Reference/Strict_mode">strict mode</a>.}}</li> | 28 <li>{{javascript-strict Always use <a href="https://developer.mozilla.org/docs
/Web/JavaScript/Reference/Strict_mode">strict mode</a>.}}</li> |
28 <li>{{javascript-operator-linebreak When splitting overlong expressions into m
ultiple lines the joining binary operators should be left at the end of the line
, before the linebreak. This does not apply to member access operators, such as
<code><fix>.</fix></code> which should be placed on the following line.}}</li> | 29 <li>{{javascript-operator-linebreak When splitting overlong expressions into m
ultiple lines the joining binary operators should be left at the end of the line
, before the linebreak. This does not apply to member access operators, such as
<code><fix>.</fix></code> which should be placed on the following line.}}</li> |
29 <li>{{javascript-if-else-braces When an <code><fix>if</fix></code> statement,
an <code><fix>else</fix></code> statement or a loop spans over more than one lin
e always enclose it with braces.}}</li> | 30 <li>{{javascript-if-else-braces When an <code><fix>if</fix></code> statement,
an <code><fix>else</fix></code> statement or a loop spans over more than one lin
e always enclose it with braces.}}</li> |
30 <li>{{s18 In classes, prefix private functions with a single underscore to mak
e them pseudo-private.}}</li> | 31 <li>{{s18 In classes, prefix private functions with a single underscore to mak
e them pseudo-private.}}</li> |
31 <li>{{javascript-spacing-literals Don't add any spaces immediately after openi
ng, or before closing, an object or array literal.}}</li> | 32 <li>{{javascript-spacing-literals Don't add any spaces immediately after openi
ng, or before closing, an object or array literal.}}</li> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 <ul> | 88 <ul> |
88 <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> | 89 <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> |
89 </ul> | 90 </ul> |
90 | 91 |
91 <h2 id="puppet">{{s31 Puppet}}</h2> | 92 <h2 id="puppet">{{s31 Puppet}}</h2> |
92 <ul> | 93 <ul> |
93 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht
ml">Puppet Style Guide</a>.}}</li> | 94 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht
ml">Puppet Style Guide</a>.}}</li> |
94 <li>{{s33 Opening braces don't go on their own line.}}</li> | 95 <li>{{s33 Opening braces don't go on their own line.}}</li> |
95 <li>{{s34 Arrows should not be aligned.}}</li> | 96 <li>{{s34 Arrows should not be aligned.}}</li> |
96 </ul> | 97 </ul> |
OLD | NEW |