servo/etc/ci/check_no_unwrap.sh
Jim Berlage 7952bd00b6 Add linting for shell scripts
This changes tidy to check shell scripts for the proper shebang and
options.  It does not check that variables are formatted correctly.  It
also adds a check for the MPL 2.0 license in shell scripts.
2016-07-22 11:53:14 -05:00

27 lines
837 B
Bash
Executable file

#!/usr/bin/env bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# Make sure listed files do not contain "unwrap"
set -o errexit
set -o nounset
set -o pipefail
# cd into repo root to make sure paths work in any case
cd "$(git rev-parse --show-toplevel)"
# files that should not contain "unwrap"
FILES=("components/compositing/compositor.rs"
"components/constellation/constellation.rs"
"components/constellation/pipeline.rs"
"ports/glutin/lib.rs"
"ports/glutin/window.rs")
# make sure the files exist
ls -1 "${FILES[@]}"
# make sure the files do not contain "unwrap" or "panic!"
! grep --line-number --with-filename "unwrap(\|panic!(" "${FILES[@]}"