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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 </li> | 96 </li> |
97 </ol> | 97 </ol> |
98 {{python-multiline-commas When breaking lists of items separated by commas (
e.g. lists, dicts, argument lists) using the second approach add a comma after t
he last element. This allows adding and rearranging items without touching unrel
ated lines.}} | 98 {{python-multiline-commas When breaking lists of items separated by commas (
e.g. lists, dicts, argument lists) using the second approach add a comma after t
he last element. This allows adding and rearranging items without touching unrel
ated lines.}} |
99 </li> | 99 </li> |
100 <li>{{python-regexp Use <a href="https://docs.python.org/2/library/re.html#re.
search"><code><fix>re.search()</fix></code></a> instead of <code><fix>re.match()
</fix></code> to avoid <a href="https://docs.python.org/2/library/re.html#search
-vs-match">confusion</a> about implied beginning of the string but not the endin
g.}}</li> | 100 <li>{{python-regexp Use <a href="https://docs.python.org/2/library/re.html#re.
search"><code><fix>re.search()</fix></code></a> instead of <code><fix>re.match()
</fix></code> to avoid <a href="https://docs.python.org/2/library/re.html#search
-vs-match">confusion</a> about implied beginning of the string but not the endin
g.}}</li> |
101 <li> | 101 <li> |
102 {{python-flake8 Run <a href="https://pypi.python.org/pypi/flake8"><fix>flake
8</fix></a> with following extensions and fix all reported errors:}} | 102 {{python-flake8 Run <a href="https://pypi.python.org/pypi/flake8"><fix>flake
8</fix></a> with following extensions and fix all reported errors:}} |
103 <ul> | 103 <ul> |
104 <li><a href="https://hg.adblockplus.org/codingtools/file/tip/flake8-eyeo">
flake8-eyeo</a></li> | 104 <li><a href="https://hg.adblockplus.org/codingtools/file/tip/flake8-eyeo">
flake8-eyeo</a></li> |
105 <li><a href="https://pypi.python.org/pypi/flake8-docstrings">flake8-docstr
ings</a> ({{python-flake8-docstring-exception with <code><fix>D1</fix></code> ig
nored}})</li> | 105 <li><a href="https://pypi.python.org/pypi/flake8-docstrings">flake8-docstr
ings</a> ({{python-flake8-docstring-exception with <code><fix>D1</fix></code> ig
nored}})</li> |
| 106 <li><a href="https://pypi.python.org/pypi/flake8-commas">flake8-commas</a>
</li> |
106 <li><a href="https://pypi.python.org/pypi/pep8-naming">pep8-naming</a></li
> | 107 <li><a href="https://pypi.python.org/pypi/pep8-naming">pep8-naming</a></li
> |
107 </ul> | 108 </ul> |
108 </li> | 109 </li> |
109 <li>{{python-tests Write tests and have them run along <fix>flake8</fix> using
<a href="https://pypi.python.org/pypi/tox"><fix>tox</fix></a>.}}</li> | 110 <li>{{python-tests Write tests and have them run along <fix>flake8</fix> using
<a href="https://pypi.python.org/pypi/tox"><fix>tox</fix></a>.}}</li> |
110 </ul> | 111 </ul> |
111 | 112 |
112 <h2 id="java">{{s22 Java}}</h2> | 113 <h2 id="java">{{s22 Java}}</h2> |
113 <ul> | 114 <ul> |
114 <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> | 115 <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> |
115 <li>{{s24 Imports should be organised consistently per file, we don't use glob
al rules.}}</li> | 116 <li>{{s24 Imports should be organised consistently per file, we don't use glob
al rules.}}</li> |
(...skipping 12 matching lines...) Expand all Loading... |
128 <ul> | 129 <ul> |
129 <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> | 130 <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> |
130 </ul> | 131 </ul> |
131 | 132 |
132 <h2 id="puppet">{{s31 Puppet}}</h2> | 133 <h2 id="puppet">{{s31 Puppet}}</h2> |
133 <ul> | 134 <ul> |
134 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht
ml">Puppet Style Guide</a>.}}</li> | 135 <li>{{s32 Follow the <a href="http://docs.puppetlabs.com/guides/style_guide.ht
ml">Puppet Style Guide</a>.}}</li> |
135 <li>{{s33 Opening braces don't go on their own line.}}</li> | 136 <li>{{s33 Opening braces don't go on their own line.}}</li> |
136 <li>{{s34 Arrows should not be aligned.}}</li> | 137 <li>{{s34 Arrows should not be aligned.}}</li> |
137 </ul> | 138 </ul> |
OLD | NEW |