Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: pages/coding-style.html

Issue 29340492: Issue 3950 - Extend the Python coding practices (Closed)
Patch Set: Created April 18, 2016, 11:17 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>{{s7 Use 2 spaces per indentation level.}}</li>
Sebastian Noack 2016/04/18 11:20:10 As we use 4 spaces for Python and 2 spaces for eve
16 <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>
17 <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>
18 <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>
19 <li>{{s11 Opening braces always go on their own line.}}</li> 18 <li>{{s11 Opening braces always go on their own line.}}</li>
20 <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>
21 <li>{{s13 Don't comment code out, delete it.}}</li> 20 <li>{{s13 Don't comment code out, delete it.}}</li>
22 <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>
23 </ul> 22 </ul>
24 23
25 <h2 id="javascript">{{s14 JavaScript}}</h2> 24 <h2 id="javascript">{{s14 JavaScript}}</h2>
(...skipping 11 matching lines...) Expand all
37 <li>{{html-css-optional-tag Don't omit optional HTML tags.}}</li> 36 <li>{{html-css-optional-tag Don't omit optional HTML tags.}}</li>
38 <li>{{html-css-hexadecimal CSS color values should be specified in hexadecimal where possible.}}</li> 37 <li>{{html-css-hexadecimal CSS color values should be specified in hexadecimal where possible.}}</li>
39 <li>{{html-css-shorthand CSS shorthand properties usage is optional.}}</li> 38 <li>{{html-css-shorthand CSS shorthand properties usage is optional.}}</li>
40 <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> 39 <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>
41 <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>
42 <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>
43 </ul> 42 </ul>
44 43
45 <h2 id="python">{{s19 Python}}</h2> 44 <h2 id="python">{{s19 Python}}</h2>
46 <ul> 45 <ul>
47 <li>{{s20 Follow the Mozilla Coding Style's <a href="https://developer.mozilla .org/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>
48 <li>{{s21 In modules, prefix private functions and variables with a single und erscore.}}</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 string, use the <a href="https://docs.python.org/2/librar y/stdtypes.html#str.format"><code><fix>format()</fix></code> method</a> when con catenating more strings.}}</li>
49 <li>{{python-tuple-vs-list Use tuples for data that have structure, use lists for data that have order.}}</li>
49 </ul> 50 </ul>
50 51
51 <h2 id="java">{{s22 Java}}</h2> 52 <h2 id="java">{{s22 Java}}</h2>
52 <ul> 53 <ul>
53 <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> 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>
54 <li>{{s24 Imports should be organised consistently per file, we don't use glob al rules.}}</li> 55 <li>{{s24 Imports should be organised consistently per file, we don't use glob al rules.}}</li>
55 </ul> 56 </ul>
56 57
57 <h2 id="cpp">{{s25 C++}}</h2> 58 <h2 id="cpp">{{s25 C++}}</h2>
58 <ul> 59 <ul>
59 <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> 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>
60 <li>{{s27 Indent namespace bodies.}}</li> 61 <li>{{s27 Indent namespace bodies.}}</li>
61 <li>{{s28 Avoid manual memory management: Use references and values when possi ble, smart pointers when necessary, raw pointers only for weak references.}}</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 >
62 <li>{{s29 Don't use C-style casts unless its exact semantics are required.}}</ li> 63 <li>{{s29 Don't use C-style casts unless its exact semantics are required.}}</ li>
63 <li>{{s30 We tend to use anonymous namespaces instead of static.}}</li> 64 <li>{{s30 We tend to use anonymous namespaces instead of static.}}</li>
64 </ul> 65 </ul>
65 66
66 <h2 id="objc">{{objective-c Objective-C}}</h2> 67 <h2 id="objc">{{objective-c Objective-C}}</h2>
67 <ul> 68 <ul>
68 <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> 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>
69 </ul> 70 </ul>
70 71
71 <h2 id="puppet">{{s31 Puppet}}</h2> 72 <h2 id="puppet">{{s31 Puppet}}</h2>
72 <ul> 73 <ul>
73 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht ml">Puppet Style Guide</a>.}}</li> 74 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht ml">Puppet Style Guide</a>.}}</li>
74 <li>{{s33 Opening braces don't go on their own line.}}</li> 75 <li>{{s33 Opening braces don't go on their own line.}}</li>
75 <li>{{s34 Arrows should not be aligned.}}</li> 76 <li>{{s34 Arrows should not be aligned.}}</li>
76 </ul> 77 </ul>
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld