mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Clean up CI bash scripts, add docs/STYLE_GUIDE.md
This commit is contained in:
parent
a868bb2a90
commit
1e0d039511
6 changed files with 56 additions and 16 deletions
29
docs/STYLE_GUIDE.md
Normal file
29
docs/STYLE_GUIDE.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
# 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.
|
Loading…
Add table
Add a link
Reference in a new issue