ae0a304c2d ci: add shellcheck job (Jose Storopoli)
9f9bd34365 shellcheck: fix warnings (Jose Storopoli)

Pull request description:

  Following https://github.com/rust-bitcoin/rust-bitcoin/pull/2762,
  adding CI shellcheck cheks here as well.

  I also did all fixes that I could find with

  ```bash
  shellcheck **/*.sh
  ```

  If I've missed any please let me know.

ACKs for top commit:
  Kixunil:
    ACK ae0a304c2d
  tcharding:
    ACK ae0a304c2d
  apoelstra:
    ACK ae0a304c2d successfully ran local tests

Tree-SHA512: 0293027439cc922ad9b1ccd5184b481d33fe80b4cd270f425805e7c31108b0bfd7ebe8a76b6aca55300584846f4ca9fbd810faa9ab1d5402e5f1be2bf12fed1a
This commit is contained in:
merge-script 2024-09-02 23:28:50 +00:00
commit 59f122dbb6
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
4 changed files with 22 additions and 11 deletions

19
.github/workflows/shellcheck.yml vendored Normal file
View File

@ -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/action-shellcheck@2.0.0
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

View File

@ -42,10 +42,6 @@ say() {
echo "extra_tests: $1"
}
say_err() {
say "$1" >&2
}
verbose_say() {
if [ "$flag_verbose" = true ]; then
say "$1"

View File

@ -48,10 +48,6 @@ say() {
echo "extra_tests: $1"
}
say_err() {
say "$1" >&2
}
verbose_say() {
if [ "$flag_verbose" = true ]; then
say "$1"

View File

@ -26,8 +26,8 @@ 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 |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
test "$(git diff --cached --name-only --diff-filter=A -z "$against" |
LC_ALL=C tr -d '[ -~]\0' | wc -c)" != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.
@ -44,7 +44,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