Left: | ||
Right: |
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 29 matching lines...) Expand all Loading... | |
40 <li>{{html-css-units CSS number values should specify units where possible.}}< /li> | 40 <li>{{html-css-units CSS number values should specify units where possible.}}< /li> |
41 <li>{{html-css-leading-zero Don't omit the optional leading 0 for decimal numb ers.}}</li> | 41 <li>{{html-css-leading-zero Don't omit the optional leading 0 for decimal numb ers.}}</li> |
42 </ul> | 42 </ul> |
43 | 43 |
44 <h2 id="python">{{s19 Python}}</h2> | 44 <h2 id="python">{{s19 Python}}</h2> |
45 <ul> | 45 <ul> |
46 <li>{{python-general Follow <a href="https://www.python.org/dev/peps/pep-0008/ ">PEP-8</a> and the Mozilla Coding Style's <a href="https://developer.mozilla.or g/en-US/docs/Developer_Guide/Coding_Style#Python_Practices">Python practices</a> .}}</li> | 46 <li>{{python-general Follow <a href="https://www.python.org/dev/peps/pep-0008/ ">PEP-8</a> and the Mozilla Coding Style's <a href="https://developer.mozilla.or g/en-US/docs/Developer_Guide/Coding_Style#Python_Practices">Python practices</a> .}}</li> |
47 <li>{{python-prefix In modules, prefix private functions and variables with a single underscore.}}</li> | 47 <li>{{python-prefix In modules, prefix private functions and variables with a single underscore.}}</li> |
48 <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> | 48 <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> |
49 <li>{{python-tuple-vs-list Use tuples for data that have structure, use lists for data that have order.}}</li> | 49 <li>{{python-tuple-vs-list Use tuples for data that have structure, use lists for data that have order.}}</li> |
50 <li>{{python-regexp Use <a href="https://docs.python.org/2/library/re.html#re. search"><code><fix>re.search()</fix></code></a> instead <a href="https://docs.py thon.org/2/library/re.html#re.match"><code><fix>re.match()</fix></code></a> to a void confusion about implied begin of string.}}</li> | |
Vasily Kuznetsov
2016/04/20 12:11:18
I think "beginning of the string" would be better
Sebastian Noack
2016/05/11 16:20:02
Yeah, I agree. I was just tried to keep in short,
| |
50 </ul> | 51 </ul> |
51 | 52 |
52 <h2 id="java">{{s22 Java}}</h2> | 53 <h2 id="java">{{s22 Java}}</h2> |
53 <ul> | 54 <ul> |
54 <li>{{s23 Follow the Mozilla Coding Style's <a href="https://developer.mozilla .org/en-US/docs/Developer_Guide/Coding_Style#Java_practices">Java practices</a>. }}</li> | 55 <li>{{s23 Follow the Mozilla Coding Style's <a href="https://developer.mozilla .org/en-US/docs/Developer_Guide/Coding_Style#Java_practices">Java practices</a>. }}</li> |
55 <li>{{s24 Imports should be organised consistently per file, we don't use glob al rules.}}</li> | 56 <li>{{s24 Imports should be organised consistently per file, we don't use glob al rules.}}</li> |
56 </ul> | 57 </ul> |
57 | 58 |
58 <h2 id="cpp">{{s25 C++}}</h2> | 59 <h2 id="cpp">{{s25 C++}}</h2> |
59 <ul> | 60 <ul> |
60 <li>{{s26 Follow the Mozilla Coding Style's <a href="https://developer.mozilla .org/en-US/docs/Developer_Guide/Coding_Style#C.2FC.2B.2B_practices">C++ practice s</a>.}}</li> | 61 <li>{{s26 Follow the Mozilla Coding Style's <a href="https://developer.mozilla .org/en-US/docs/Developer_Guide/Coding_Style#C.2FC.2B.2B_practices">C++ practice s</a>.}}</li> |
61 <li>{{s27 Indent namespace bodies.}}</li> | 62 <li>{{s27 Indent namespace bodies.}}</li> |
62 <li>{{s28 Avoid manual memory management: Use references and values when possi ble, smart pointers when necessary, raw pointers only for weak references.}}</li > | 63 <li>{{s28 Avoid manual memory management: Use references and values when possi ble, smart pointers when necessary, raw pointers only for weak references.}}</li > |
63 <li>{{s29 Don't use C-style casts unless its exact semantics are required.}}</ li> | 64 <li>{{s29 Don't use C-style casts unless its exact semantics are required.}}</ li> |
64 <li>{{s30 We tend to use anonymous namespaces instead of static.}}</li> | 65 <li>{{s30 We tend to use anonymous namespaces instead of static.}}</li> |
65 </ul> | 66 </ul> |
66 | 67 |
67 <h2 id="objc">{{objective-c Objective-C}}</h2> | 68 <h2 id="objc">{{objective-c Objective-C}}</h2> |
68 <ul> | 69 <ul> |
69 <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> | 70 <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> |
70 </ul> | 71 </ul> |
71 | 72 |
72 <h2 id="puppet">{{s31 Puppet}}</h2> | 73 <h2 id="puppet">{{s31 Puppet}}</h2> |
73 <ul> | 74 <ul> |
74 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht ml">Puppet Style Guide</a>.}}</li> | 75 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht ml">Puppet Style Guide</a>.}}</li> |
75 <li>{{s33 Opening braces don't go on their own line.}}</li> | 76 <li>{{s33 Opening braces don't go on their own line.}}</li> |
76 <li>{{s34 Arrows should not be aligned.}}</li> | 77 <li>{{s34 Arrows should not be aligned.}}</li> |
77 </ul> | 78 </ul> |
OLD | NEW |