Merge pull request #144 from bpkg/shellcheck/2022-03

Shellcheck updates
pull/152/head
Ben Peachey 2 years ago committed by GitHub
commit c9b8c46c32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,57 +0,0 @@
---
# The idea here is to run Shellcheck for each file, so violations can be fixed
# incrementally. As soon as a file has been fixed to pass shellcheck, it should
# no longer be allowed to fail.
#
# Once all files have been fixed, the jobs can all be replaced by one single run
# that checks all files at once.
#
# For discussion and further details see: https://github.com/bpkg/bpkg/issues/78
on:
- push
- pull_request
jobs:
allowed_to_fail:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file:
- bpkg.sh
- setup.sh
- lib/init/init.sh
- lib/install/install.sh
- lib/json/JSON.sh
- lib/suggest/suggest.sh
steps:
- uses: actions/checkout@v2
- uses: pipeline-components/shellcheck@v0.6.1
continue-on-error: true
with:
directory: ${{ matrix.file }}
options: -f gcc -x lib/utils/utils.sh
must_pass:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
file:
- lib/getdeps/getdeps.sh
- lib/list/list.sh
- lib/package/package.sh
- lib/show/show.sh
- lib/term/term.sh
- lib/update/update.sh
- lib/utils/utils.sh
- lib/env/env.sh
- lib/run/run.sh
- lib/source/source.sh
steps:
- uses: actions/checkout@v2
- uses: pipeline-components/shellcheck@v0.6.1
with:
directory: ${{ matrix.file }}
options: -f gcc -x lib/utils/utils.sh

@ -0,0 +1,21 @@
on:
- push
- pull_request
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- env:
PIPELINECOMPONENTS_GLOBASSIST: true
uses: pipeline-components/shellcheck@v0.10.0
with:
directory: "**/*.sh"
options: --format=gcc --external-sources

@ -1,3 +1,6 @@
# ============================================================================ #
# Disable specific checks
# ---------------------------------------------------------------------------- #
# shellcheck disable=SC2034
## Allow: To read lines rather than words, pipe/redirect to a 'while read' loop
@ -12,5 +15,22 @@ disable=SC2207
## Allow: Instead of 'let expr', prefer (( expr ))
disable=SC2219
## Allow: Not following source
disable=SC1091
#Allow: non-standard `which` in shellcheck < 0.7.1
disable=SC2230
# ============================================================================ #
# ============================================================================ #
# Enable optional checks (since 0.7.0).
# ---------------------------------------------------------------------------- #
## Suggest adding a default case in `case` statements
#enable=add-default-case
## Suggest explicitly using -n in `[ $var ]`
#enable=avoid-nullary-conditions
## Suggest quoting variables without metacharacters
#enable=quote-safe-variables
## Suggest putting braces around all variable references
#enable=require-variable-braces
# ============================================================================ #

@ -6,7 +6,6 @@ if ! type -f bpkg-utils &>/dev/null; then
echo "error: bpkg-utils not found, aborting"
exit 1
else
# shellcheck disable=SC2230
# shellcheck source=lib/utils/utils.sh
source "$(which bpkg-utils)"
fi

@ -4,7 +4,6 @@ if ! type -f bpkg-utils &>/dev/null; then
echo "error: bpkg-utils not found, aborting"
exit 1
else
# shellcheck disable=SC2230
# shellcheck source=lib/utils/utils.sh
source "$(which bpkg-utils)"
fi
@ -22,7 +21,6 @@ if ! type -f bpkg-install &>/dev/null; then
echo "error: bpkg-install not found, aborting"
exit 1
else
# shellcheck disable=SC2230
# shellcheck source=lib/install/install.sh
source "$(which bpkg-install)"
fi
@ -31,7 +29,6 @@ if ! type -f bpkg-package &>/dev/null; then
echo "error: bpkg-package not found, aborting"
exit 1
else
# shellcheck disable=SC2230
# shellcheck source=lib/package/package.sh
source "$(which bpkg-package)"
fi

@ -6,7 +6,6 @@ if ! type -f bpkg-utils &>/dev/null; then
echo "error: bpkg-utils not found, aborting"
exit 1
else
# shellcheck disable=SC2230
# shellcheck source=lib/utils/utils.sh
source "$(which bpkg-utils)"
fi

@ -4,7 +4,6 @@ if ! type -f bpkg-run &>/dev/null; then
echo "error: bpkg-run not found, aborting"
exit 1
else
# shellcheck disable=SC2230
# shellcheck source=lib/run/run.sh
source "$(which bpkg-run)"
fi

@ -6,7 +6,6 @@ if ! type -f bpkg-utils &>/dev/null; then
echo "error: bpkg-utils not found, aborting"
exit 1
else
# shellcheck disable=SC2230
# shellcheck source=lib/utils/utils.sh
source "$(which bpkg-utils)"
fi
@ -81,4 +80,3 @@ if [[ ${BASH_SOURCE[0]} != "$0" ]]; then
elif bpkg_validate; then
bpkg_update "${@}"
fi

Loading…
Cancel
Save