Apple no longer uses the OS X branding. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: b8b2a8287a3875ac772ea9252de40282868238ab
30 lines
834 B
Markdown
30 lines
834 B
Markdown
# 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 macOS 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.
|