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 26 matching lines...) Expand all Loading... |
37 <li>{{javascript-arrow Use the <a href="https://developer.mozilla.org/docs/W
eb/JavaScript/Reference/Functions/Arrow_functions">arrow function</a> syntax whe
n passing anonymous functions that don't require the binding of their own <code>
<fix>this</fix></code> or <code><fix>arguments</fix></code> variables.}}</li> | 37 <li>{{javascript-arrow Use the <a href="https://developer.mozilla.org/docs/W
eb/JavaScript/Reference/Functions/Arrow_functions">arrow function</a> syntax whe
n passing anonymous functions that don't require the binding of their own <code>
<fix>this</fix></code> or <code><fix>arguments</fix></code> variables.}}</li> |
38 <li>{{javascript-method Use the <a href="https://developer.mozilla.org/docs/
Web/JavaScript/Reference/Functions/Method_definitions">method definition shortha
nd</a> syntax when defining methods on an object.}}</li> | 38 <li>{{javascript-method Use the <a href="https://developer.mozilla.org/docs/
Web/JavaScript/Reference/Functions/Method_definitions">method definition shortha
nd</a> syntax when defining methods on an object.}}</li> |
39 <li>{{javascript-for-of When iterating over arrays in the canonical order us
e the new <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/S
tatements/for...of"><code><fix>for..of</fix></code></a> syntax if the loop index
isn't required. (Rather than using <code><fix>for(;;)</fix></code> or the <code
><fix>forEach()</fix></code> method.)}}</li> | 39 <li>{{javascript-for-of When iterating over arrays in the canonical order us
e the new <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/S
tatements/for...of"><code><fix>for..of</fix></code></a> syntax if the loop index
isn't required. (Rather than using <code><fix>for(;;)</fix></code> or the <code
><fix>forEach()</fix></code> method.)}}</li> |
40 <li>{{javascript-map-set Use the <a href="https://developer.mozilla.org/docs
/Web/JavaScript/Reference/Global_Objects/Map"><code><fix>Map</fix></code></a> or
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Obj
ects/Set"><code><fix>Set</fix></code></a> objects, rather than misusing plain ob
jects, when you need a hash table.}}</li> | 40 <li>{{javascript-map-set Use the <a href="https://developer.mozilla.org/docs
/Web/JavaScript/Reference/Global_Objects/Map"><code><fix>Map</fix></code></a> or
<a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Obj
ects/Set"><code><fix>Set</fix></code></a> objects, rather than misusing plain ob
jects, when you need a hash table.}}</li> |
41 <li>{{javascript-eslint Run <a href="http://eslint.org"><fix>ESLint</fix></a
> with the <a href="https://hg.adblockplus.org/codingtools/file/tip/eslint-confi
g-eyeo"><fix>eslint-config-eyeo</fix></a> configuration and fix any warning.}}</
li> | 41 <li>{{javascript-eslint Run <a href="http://eslint.org"><fix>ESLint</fix></a
> with the <a href="https://hg.adblockplus.org/codingtools/file/tip/eslint-confi
g-eyeo"><fix>eslint-config-eyeo</fix></a> configuration and fix any warning.}}</
li> |
42 </ul> | 42 </ul> |
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.xml">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> | 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> | 54 <li>{{html-css-leading-zero Don't omit the optional leading 0 for decimal numb
ers.}}</li> |
55 </ul> | 55 </ul> |
56 | 56 |
57 <h2 id="python">{{s19 Python}}</h2> | 57 <h2 id="python">{{s19 Python}}</h2> |
(...skipping 30 matching lines...) Expand all Loading... |
88 <ul> | 88 <ul> |
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 <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> |
90 </ul> | 90 </ul> |
91 | 91 |
92 <h2 id="puppet">{{s31 Puppet}}</h2> | 92 <h2 id="puppet">{{s31 Puppet}}</h2> |
93 <ul> | 93 <ul> |
94 <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> |
95 <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> |
96 <li>{{s34 Arrows should not be aligned.}}</li> | 96 <li>{{s34 Arrows should not be aligned.}}</li> |
97 </ul> | 97 </ul> |
OLD | NEW |