Skip to content
This repository was archived by the owner on Feb 25, 2019. It is now read-only.

Commit 0ee05d0

Browse files
Merge pull request #243 from anvilresearch/vsimonian-contributors-guide-code-style
Create separate section for code style guidelines
2 parents ca3a48d + 41f87b4 commit 0ee05d0

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

CONTRIBUTING.md

+83
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,89 @@ We welcome code contributions and participation in bug fixes and issues.
4747
- Verify that dependencies are listed in manifest
4848
- Features must include test coverage and code review to be accepted
4949

50+
#### Style guidelines
51+
##### Javascript
52+
We follow [Javascript Standard Style](https://github.com/feross/standard#rules).
53+
54+
##### Other
55+
- **Indents are 2 spaces; no tab characters** (unless required by the language).
56+
<table>
57+
<tr><th>Not OK</th><th>OK</th></tr>
58+
<tr><td><pre lang="html">
59+
&lt;html&gt;
60+
&nbsp; &lt;head&gt;&lt;/head&gt;
61+
&nbsp; &lt;body&gt;
62+
&nbsp; &lt;div&gt;Hello world&lt;/div&gt;
63+
&nbsp; &lt;/body&gt;
64+
&lt;/html&gt;
65+
</pre></td>
66+
<td><pre lang="html">
67+
&lt;html&gt;
68+
&nbsp; &lt;head&gt;&lt;/head&gt;
69+
&nbsp; &lt;body&gt;
70+
&nbsp; &lt;div&gt;Hello world&lt;/div&gt;
71+
&nbsp; &lt;/body&gt;
72+
&lt;/html&gt;
73+
</pre></td></tr>
74+
</table>
75+
76+
77+
- **Non-binary files must end with a new-line character.**
78+
<table>
79+
<tr><th>Not OK</th><th>OK</th></tr>
80+
<tr><td><img src="https://cloud.githubusercontent.com/assets/9868643/10029550/5f7d2a8e-6127-11e5-85bd-e59e6a048f2a.png" alt="Missing new-line character" width="200"></td>
81+
<td><img src="https://cloud.githubusercontent.com/assets/9868643/10029556/6750fbfa-6127-11e5-8283-85124cc119dd.png" alt="New-line character" width="200"></td></tr>
82+
</table>
83+
84+
85+
- **No trailing whitespace** (unless required by the language).
86+
<table>
87+
<tr><th>Not OK</th><th>OK</th></tr>
88+
<tr><td><img src="https://cloud.githubusercontent.com/assets/9868643/10030416/6ead5010-612c-11e5-9093-f96e32ca53af.png" alt="Trailing whitespace" width="225"></td>
89+
<td><img src="https://cloud.githubusercontent.com/assets/9868643/10030415/6dad6470-612c-11e5-89a7-607fe49620f4.png" alt="No trailing whitespace" width="225"></td></tr>
90+
</table>
91+
92+
- **Avoid excess whitespace around code.**
93+
<table>
94+
<tr><th>Not OK</th><th>OK</th></tr>
95+
<tr><td><code>identifier( param, &nbsp; &nbsp; &nbsp; param )</code></td>
96+
<td><code>identifier(param, param)</code></td></tr>
97+
<tr><td><pre lang="yaml">
98+
prop: value
99+
prop1: value
100+
prop1a: value
101+
</pre></td>
102+
<td><pre lang="yaml">
103+
prop: value
104+
prop1: value
105+
prop1a: value
106+
</pre></td></tr>
107+
</table>
108+
- **No more than one empty line at a time.**
109+
<table>
110+
<tr><th>Not OK</th><th>OK</th></tr>
111+
<tr><td>
112+
<pre lang="css">
113+
/* Special Classes */
114+
.fancy { ... }
115+
.jumbotron { ... }
116+
117+
118+
/* Other Classes */
119+
.floaty-boaty { ... }
120+
</pre>
121+
</td>
122+
<td>
123+
<pre lang="css">
124+
/* Special Classes */
125+
.fancy { ... }
126+
.jumbotron { ... }
127+
128+
/* Other Classes */
129+
.floaty-boaty { ... }
130+
</pre>
131+
</td></tr>
132+
</table>
50133

51134
### How to submit new code:
52135

0 commit comments

Comments
 (0)