Auto merge of #12736 - aneeshusa:prohibit-backticks-in-shell-scripts, r=Wafflespeanut

Add more shell script lints

<!-- Please describe your changes on the following line: -->

The "$(some_command arg1 arg2)" form is preferred to the
`some_command arg1 arg2` form because it nests unambiguously.
Add a lint for this to tidy.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12736)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-08-06 21:57:31 -05:00 committed by GitHub
commit aa900b91aa
10 changed files with 63 additions and 35 deletions

View file

@ -8,28 +8,28 @@ set -o errexit
set -o nounset
set -o pipefail
if [ $# -eq 0 ]; then
echo "Usage: $0 /path/to/gecko/objdir [other-regen.py-flags]"
if [[ ${#} -eq 0 ]]; then
echo "Usage: ${0} /path/to/gecko/objdir [other-regen.py-flags]"
exit 1
fi
# Check for rust-bindgen
if [ ! -d rust-bindgen ]; then
if [[ ! -d rust-bindgen ]]; then
echo "rust-bindgen not found. Run setup_bindgen.sh first."
exit 1
fi
# Check for /usr/include
if [ ! -d /usr/include ]; then
if [[ ! -d /usr/include ]]; then
echo "/usr/include doesn't exist." \
"Mac users may need to run xcode-select --install."
exit 1
fi
if [ "$(uname)" == "Linux" ]; then
LIBCLANG_PATH=/usr/lib/llvm-3.8/lib;
if [[ "$(uname)" == "Linux" ]]; then
LIBCLANG_PATH=/usr/lib/llvm-3.8/lib
else
LIBCLANG_PATH=`brew --prefix llvm38`/lib/llvm-3.8/lib;
LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"
fi
./regen.py --target all "$@"
./regen.py --target all "${@}"

View file

@ -9,33 +9,33 @@ set -o nounset
set -o pipefail
# Run in the tools directory.
cd "$(dirname $0)"
cd "$(dirname ${0})"
# Setup and build bindgen.
if [ "$(uname)" == "Linux" ]; then
export LIBCLANG_PATH=/usr/lib/llvm-3.8/lib;
if [[ "$(uname)" == "Linux" ]]; then
export LIBCLANG_PATH=/usr/lib/llvm-3.8/lib
else
export LIBCLANG_PATH=`brew --prefix llvm38`/lib/llvm-3.8/lib;
export LIBCLANG_PATH="$(brew --prefix llvm38)/lib/llvm-3.8/lib"
fi
# Make sure we have llvm38.
if [ ! -x "$(command -v clang-3.8)" ]; then
if [[ ! -x "$(command -v clang-3.8)" ]]; then
echo "llmv38 must be installed." \
"Mac users should |brew install llvm38|, Linux varies by distro."
exit 1
fi
export LD_LIBRARY_PATH=$LIBCLANG_PATH
export DYLD_LIBRARY_PATH=$LIBCLANG_PATH
export LD_LIBRARY_PATH="${LIBCLANG_PATH}"
export DYLD_LIBRARY_PATH="${LIBCLANG_PATH}"
# Check for multirust
if [ ! -x "$(command -v multirust)" ]; then
if [[ ! -x "$(command -v multirust)" ]]; then
echo "multirust must be installed."
exit 1
fi
# Don't try to clone twice.
if [ ! -d rust-bindgen ]; then
if [[ ! -d rust-bindgen ]]; then
git clone https://github.com/servo/rust-bindgen.git
fi