Skip to content

Commit

Permalink
ci: shellcheck checks
Browse files Browse the repository at this point in the history
  • Loading branch information
storopoli committed Aug 7, 2024
1 parent 2753b9e commit b3faab6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Shellcheck
on:
pull_request:
branches:
- master
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/[email protected]
env:
SHELLCHECK_OPTS: -x # allow outside sources
with:
# This code comes directly from upstream libsecp256k1
# and should not be linted here.
ignore_paths: ./secp256k1-sys/depend/**/*.sh
1 change: 0 additions & 1 deletion contrib/_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

set -ex

REPO_DIR=$(git rev-parse --show-toplevel)
FEATURES="hashes global-context lowmemory rand recovery serde std alloc"

cargo --version
Expand Down
2 changes: 1 addition & 1 deletion contrib/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fi
for dep in $DEPS
do
cp "Cargo-$dep.lock" Cargo.lock
$REPO_DIR/contrib/_test.sh
"$REPO_DIR"/contrib/_test.sh

if [ "$dep" = recent ];
then
Expand Down
6 changes: 4 additions & 2 deletions githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ exec 1>&2
# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
# disable the check to quoting the $(...) command
# shellcheck disable=SC2046
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
test $(git diff --cached --name-only --diff-filter=A -z "$against" |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Expand All @@ -44,7 +46,7 @@ EOF
fi

# If there are whitespace errors, print the offending file names and fail.
git diff-index --check --cached $against -- || exit 1
git diff-index --check --cached "$against" -- || exit 1

# Check that code lints cleanly.
cargo clippy --features=rand,std,recovery,lowmemory,global-context --all-targets -- -D warnings || exit 1
Expand Down

0 comments on commit b3faab6

Please sign in to comment.