servo/docs/STYLE_GUIDE.md
author Nicholas Nethercote <nnethercote@mozilla.com>
Mon, 31 Jul 2017 14:28:48 +1000
changeset 420768 2b347fb55a9965acec727f6e40671ba859636603
parent 385324 fe7e4ea3cda6c5a0dc746f55e209a0b60aeffc0d
child 463732 befe8c748a4b4dad323ac9333a50c7fa0e870cfa
permissions -rw-r--r--
Bug 1384835 (part 3, attempt 2) - Remove the Preferences::Get*CString() variants that return nsAdoptingCString. r=froydnj.

# Style Guide

The majority of our style recommendations are automatically enforced via our
automated linters. This document has guidelines that are less easy to lint for.

## Shell scripts

Shell scripts are OK for small tasks or wrappers, but prefer to use Python for
anything with a hint of complexity or in general.

Shell scripts should be written against bash, starting with this shebang:
```
#!/usr/bin/env bash
```

Note that the version of bash available on OS X by default is quite old, so be
careful when using new features.

Scripts should enable a few options at the top for robustness:
```
set -o errexit
set -o nounset
set -o pipefail
```

Quote all variables, using the full form: `"${SOME_VARIABLE}"`.

Use `"$(some-command)"` instead of backticks for command substitution. Note
that these should be quoted as well.