Skip to content

Commit 23df125

Browse files
committed
dataconnect: shellcheck all bash shell scripts
1 parent 803857d commit 23df125

12 files changed

+71
-14
lines changed

.github/workflows/dataconnect.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,17 @@ jobs:
271271
with:
272272
args: -color /github/workspace/.github/workflows/dataconnect.yml
273273

274+
shellcheck:
275+
continue-on-error: false
276+
runs-on: ubuntu-latest
277+
steps:
278+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
279+
with:
280+
show-progress: false
281+
sparse-checkout: 'firebase-dataconnect/'
282+
- name: shellcheck
283+
run: find . -name '*.sh' -print0 | xargs --verbose -0 shellcheck --norc --enable=all --shell=bash
284+
274285
python-ci-unit-tests:
275286
continue-on-error: false
276287
runs-on: ubuntu-latest

firebase-dataconnect/emulator/emulator.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly SCRIPT_DIR="$(dirname "$0")"
19+
SCRIPT_DIR="$(dirname "$0")"
20+
readonly SCRIPT_DIR
2021
readonly SELF_EXECUTABLE="$0"
2122
readonly LOG_PREFIX="[$0] "
2223
readonly DEFAULT_POSTGRESQL_STRING='postgresql://postgres:postgres@localhost:5432?sslmode=disable'
@@ -38,7 +39,7 @@ function parse_args {
3839
local OPTIND=1
3940
local OPTERR=0
4041
while getopts ":c:p:v:hw" arg ; do
41-
case "$arg" in
42+
case "${arg}" in
4243
c) emulator_binary="${OPTARG}" ;;
4344
p) postgresql_string="${OPTARG}" ;;
4445
v) preview_flags="${OPTARG}" ;;
@@ -58,7 +59,7 @@ function parse_args {
5859
exit 2
5960
;;
6061
*)
61-
echo "INTERNAL ERROR: unknown argument: $arg" >&2
62+
echo "INTERNAL ERROR: unknown argument: ${arg}" >&2
6263
exit 1
6364
;;
6465
esac
@@ -68,7 +69,7 @@ function parse_args {
6869
export FIREBASE_DATACONNECT_POSTGRESQL_STRING="${postgresql_string}"
6970
export DATA_CONNECT_PREVIEW="${preview_flags}"
7071

71-
if [[ $wipe_and_restart_postgres_pod == "1" ]] ; then
72+
if [[ ${wipe_and_restart_postgres_pod} == "1" ]] ; then
7273
run_command "${SCRIPT_DIR}/wipe_postgres_db.sh"
7374
run_command "${SCRIPT_DIR}/start_postgres_pod.sh"
7475
fi

firebase-dataconnect/emulator/start_postgres_pod.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ function run_command {
2525
"$@"
2626
}
2727

28-
# Determine the absolute path of the directory containing this file.
29-
readonly SCRIPT_DIR="$(readlink -f $(dirname "$0"))"
28+
# Determine the path of the directory containing this file.
29+
SCRIPT_DIR="$(dirname "$0")"
30+
readonly SCRIPT_DIR
3031

3132
# Create the podman "pod" if it is not already created.
3233
# Bind the PostgreSQL server to port 5432 on the host, so that the host can connect to it.

firebase-dataconnect/scripts/compile_kotlin.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
19+
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
20+
readonly PROJECT_ROOT_DIR
2021

2122
readonly TARGETS=(
2223
":firebase-dataconnect:compileDebugKotlin"

firebase-dataconnect/scripts/emulator_run.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
19+
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
20+
readonly PROJECT_ROOT_DIR
2021

2122
(
2223
set -xv

firebase-dataconnect/scripts/generateApiTxtFile.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
19+
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
20+
readonly PROJECT_ROOT_DIR
2021

2122
readonly args=(
2223
"${PROJECT_ROOT_DIR}/gradlew"

firebase-dataconnect/scripts/generate_data_connect_sources.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
19+
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
20+
readonly PROJECT_ROOT_DIR
2021

2122
readonly TARGETS=(
2223
":firebase-dataconnect:connectors:generateDebugDataConnectSources"

firebase-dataconnect/scripts/run_all_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
19+
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
20+
readonly PROJECT_ROOT_DIR
2021

2122
readonly TARGETS=(
2223
":firebase-dataconnect:androidTestutil:connectedDebugAndroidTest"

firebase-dataconnect/scripts/run_integration_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
19+
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
20+
readonly PROJECT_ROOT_DIR
2021

2122
readonly TARGETS=(
2223
":firebase-dataconnect:connectedDebugAndroidTest"

firebase-dataconnect/scripts/run_unit_tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
set -euo pipefail
1818

19-
readonly PROJECT_ROOT_DIR="$(dirname "$0")/../.."
19+
PROJECT_ROOT_DIR="$(dirname "$0")/../.."
20+
readonly PROJECT_ROOT_DIR
2021

2122
readonly TARGETS=(
2223
":firebase-dataconnect:testDebugUnitTest"

0 commit comments

Comments
 (0)