1
0
Fork 0
mirror of synced 2024-11-08 09:48:58 -05:00

more will be added later

Matt Hamilton 2015-12-29 11:59:03 -05:00
parent 7e9ea82ef9
commit 392533d0ca

56
Code-Style-Guide.md Normal file

@ -0,0 +1,56 @@
These are the code style guidelines that should be followed when contributing to Zim.
Indentation
-----------
Indent = two spaces
Not hard tabs. Not four spaces. Not however many spaces you feel like.
2 spaces.
Line Length
-----------
Be reasonable. Keeping within 80 characters is recommended, 120 is the maximum.
Variables
---------
Limit the scope of variables to `local` if within a function.
Wrap your variables in `${curly}` `${braces}`.
Use `${snake_case}` for your variables.
**NOT** `${camelCase}` or `${FuCk_you_iDoWhat_i_want}`.
Use existing variables whenever possible.
| Bad | Good |
| --- | ---- |
| `$(pwd)` | `${PWD}` |
| `$(whoami)` | `${USER}` |
Flow Logic
----------
Place `; do` `; then` on the same line as `while`, `for`, and `if`.
Functions
---------
Use POSIX syntax:
```
foo() {
print 'bar'
}
```
NOTE: There *is* a difference between this and ksh style, but unless you know what it is and you're **sure** you need it, use POSIX.
Misc
----
Do **NOT** use backticks ``` ` ``` to execute something in a subshell. This GRINDS MY GEARS.
`$(print "use parentheses")`