diff --git a/development/shellcheck.sh b/development/shellcheck.sh new file mode 100755 index 000000000..ec326908d --- /dev/null +++ b/development/shellcheck.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e +set -u +set -x +set -o pipefail + +shellcheck --version +# lint all *.sh files +find . -type f -name '*.sh' ! -path './node_modules/*' -print0 | xargs -0 shellcheck +# lint all .scripts in package.json +# shellcheck disable=SC2016 +list=$(jq -r '.scripts | keys[] as $key | .[$key]' < package.json) +printf "#!/bin/bash\n%s\n" "$list" | shellcheck - diff --git a/package.json b/package.json index 48bbf8590..985b08f3c 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "test:web3:firefox": "SELENIUM_BROWSER=firefox test/e2e/run-web3.sh", "test:e2e:firefox": "SELENIUM_BROWSER=firefox test/e2e/run-all.sh", "test:coverage": "nyc --reporter=text --reporter=html npm run test:unit", - "test:coveralls-upload": "if [ $COVERALLS_REPO_TOKEN ]; then nyc report --reporter=text-lcov | coveralls; fi", + "test:coveralls-upload": "if [ \"$COVERALLS_REPO_TOKEN\" ]; then nyc report --reporter=text-lcov | coveralls; fi", "test:flat": "yarn test:flat:build && karma start test/flat.conf.js", "test:flat:build": "yarn test:flat:build:ui && yarn test:flat:build:tests && yarn test:flat:build:locales", "test:flat:build:tests": "node test/integration/index.js", @@ -39,7 +39,7 @@ "lint:fix": "eslint . --ext js,json --fix", "lint:changed": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' --regexp='[.]json$' | tr '\\n' '\\0' | xargs -0 eslint", "lint:changed:fix": "{ git ls-files --others --exclude-standard ; git diff-index --name-only --diff-filter=d HEAD ; } | grep --regexp='[.]js$' --regexp='[.]json$' | tr '\\n' '\\0' | xargs -0 eslint --fix", - "lint:shellcheck": "shellcheck --version && find . -type f -name '*.sh' ! -path './node_modules/*' -print0 | xargs -0 shellcheck", + "lint:shellcheck": "./development/shellcheck.sh", "verify-locales": "node ./development/verify-locale-strings.js", "verify-locales:fix": "node ./development/verify-locale-strings.js --fix", "mozilla-lint": "addons-linter dist/firefox",