From 32e2b8f85895f7656e952ad8c6d27a60838e932e Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Wed, 26 Aug 2026 18:41:40 +0100 Subject: [PATCH] =?UTF-8?q?fix(shell):=20declare=20the=20shell=20=E2=80=94?= =?UTF-8?q?=20shebang=20where=20executed,=20directive=20where=20sourced?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shellcheck SC2148 ('target shell is unknown') on 12 files here. Deliberately NOT a blanket shebang. The files split by how they are USED: * 12 executed (have +x, never source'd) -> added '#!/usr/bin/env bash' * 0 sourced (referenced by source/.) -> added '# shellcheck shell=bash' A source'd file is never run as its own process, so a shebang there is misleading — it claims an execution model the file does not have. The shellcheck directive states the dialect without making that false claim. Found by an estate-wide sweep of 5,111 tracked scripts across 375 repos: 85 files lack a shell declaration. 40 of those were left alone deliberately — they are vendored duplicates (7 identical copies of one recoverer.sh) or a nested kith/ tree, and 37 of the 40 are never invoked by name anywhere, so editing them would be churn in vendored code. Remaining SC2148 in this repo after the change: 22 --- .../tests/analysis_tests/tests-generic-jsx-transform/test.sh | 1 + .../tests/analysis_tests/tests-incremental-typechecking/test.sh | 1 + .../tests/analysis_tests/tests-reanalyze/deadcode/test.sh | 1 + .../tests/analysis_tests/tests-reanalyze/termination/test.sh | 1 + .../core/compiler-source/tests/analysis_tests/tests/test.sh | 1 + .../packages/core/compiler-source/tests/tools_tests/test.sh | 1 + .../tests/analysis_tests/tests-generic-jsx-transform/test.sh | 1 + .../tests/analysis_tests/tests-incremental-typechecking/test.sh | 1 + .../tests/analysis_tests/tests-reanalyze/deadcode/test.sh | 1 + .../tests/analysis_tests/tests-reanalyze/termination/test.sh | 1 + rescript-ecosystem/rescript/tests/analysis_tests/tests/test.sh | 1 + rescript-ecosystem/rescript/tests/tools_tests/test.sh | 1 + 12 files changed, 12 insertions(+) diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-generic-jsx-transform/test.sh b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-generic-jsx-transform/test.sh index c58c8e70b..9e049e22e 100755 --- a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-generic-jsx-transform/test.sh +++ b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-generic-jsx-transform/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.res; do output="$(dirname $file)/expected/$(basename $file).txt" ../../../_build/install/default/bin/rescript-editor-analysis test $file &> $output diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-incremental-typechecking/test.sh b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-incremental-typechecking/test.sh index c58c8e70b..9e049e22e 100755 --- a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-incremental-typechecking/test.sh +++ b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-incremental-typechecking/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.res; do output="$(dirname $file)/expected/$(basename $file).txt" ../../../_build/install/default/bin/rescript-editor-analysis test $file &> $output diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/deadcode/test.sh b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/deadcode/test.sh index a408b9da0..b1ad21c1b 100755 --- a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/deadcode/test.sh +++ b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/deadcode/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash DEBUG_FLAG="-debug" if [ "$RUNNER_OS" == "Windows" ]; then diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/termination/test.sh b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/termination/test.sh index 7c301befb..dbab638bc 100755 --- a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/termination/test.sh +++ b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests-reanalyze/termination/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash output="expected/termination.txt" dune exec rescript-tools -- reanalyze -config -ci -debug > $output # CI. We use LF, and the CI OCaml fork prints CRLF. Convert. diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests/test.sh b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests/test.sh index 993782b86..12fd9b5ae 100755 --- a/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests/test.sh +++ b/rescript-ecosystem/packages/core/compiler-source/tests/analysis_tests/tests/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).txt" ../../../_build/install/default/bin/rescript-editor-analysis test $file &> $output diff --git a/rescript-ecosystem/packages/core/compiler-source/tests/tools_tests/test.sh b/rescript-ecosystem/packages/core/compiler-source/tests/tools_tests/test.sh index 4e44f4217..d111ad3d5 100755 --- a/rescript-ecosystem/packages/core/compiler-source/tests/tools_tests/test.sh +++ b/rescript-ecosystem/packages/core/compiler-source/tests/tools_tests/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).json" ../../_build/install/default/bin/rescript-tools doc $file > $output diff --git a/rescript-ecosystem/rescript/tests/analysis_tests/tests-generic-jsx-transform/test.sh b/rescript-ecosystem/rescript/tests/analysis_tests/tests-generic-jsx-transform/test.sh index c58c8e70b..9e049e22e 100755 --- a/rescript-ecosystem/rescript/tests/analysis_tests/tests-generic-jsx-transform/test.sh +++ b/rescript-ecosystem/rescript/tests/analysis_tests/tests-generic-jsx-transform/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.res; do output="$(dirname $file)/expected/$(basename $file).txt" ../../../_build/install/default/bin/rescript-editor-analysis test $file &> $output diff --git a/rescript-ecosystem/rescript/tests/analysis_tests/tests-incremental-typechecking/test.sh b/rescript-ecosystem/rescript/tests/analysis_tests/tests-incremental-typechecking/test.sh index c58c8e70b..9e049e22e 100755 --- a/rescript-ecosystem/rescript/tests/analysis_tests/tests-incremental-typechecking/test.sh +++ b/rescript-ecosystem/rescript/tests/analysis_tests/tests-incremental-typechecking/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.res; do output="$(dirname $file)/expected/$(basename $file).txt" ../../../_build/install/default/bin/rescript-editor-analysis test $file &> $output diff --git a/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/deadcode/test.sh b/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/deadcode/test.sh index a408b9da0..b1ad21c1b 100755 --- a/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/deadcode/test.sh +++ b/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/deadcode/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash DEBUG_FLAG="-debug" if [ "$RUNNER_OS" == "Windows" ]; then diff --git a/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/termination/test.sh b/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/termination/test.sh index 7c301befb..dbab638bc 100755 --- a/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/termination/test.sh +++ b/rescript-ecosystem/rescript/tests/analysis_tests/tests-reanalyze/termination/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash output="expected/termination.txt" dune exec rescript-tools -- reanalyze -config -ci -debug > $output # CI. We use LF, and the CI OCaml fork prints CRLF. Convert. diff --git a/rescript-ecosystem/rescript/tests/analysis_tests/tests/test.sh b/rescript-ecosystem/rescript/tests/analysis_tests/tests/test.sh index 993782b86..12fd9b5ae 100755 --- a/rescript-ecosystem/rescript/tests/analysis_tests/tests/test.sh +++ b/rescript-ecosystem/rescript/tests/analysis_tests/tests/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).txt" ../../../_build/install/default/bin/rescript-editor-analysis test $file &> $output diff --git a/rescript-ecosystem/rescript/tests/tools_tests/test.sh b/rescript-ecosystem/rescript/tests/tools_tests/test.sh index 4e44f4217..d111ad3d5 100755 --- a/rescript-ecosystem/rescript/tests/tools_tests/test.sh +++ b/rescript-ecosystem/rescript/tests/tools_tests/test.sh @@ -1,3 +1,4 @@ +#!/usr/bin/env bash for file in src/*.{res,resi}; do output="$(dirname $file)/expected/$(basename $file).json" ../../_build/install/default/bin/rescript-tools doc $file > $output