Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions core/scripts/ldd-detect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ BUNDLE=""
usage() { sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2; }
die() { echo "$SCRIPT_NAME: $*" >&2; exit 2; }

# value <option> <remaining argument count> — a value-taking option needs one
value() { (( $2 >= 2 )) || die "$1 needs a value"; }

while (( $# > 0 )); do
case "$1" in
--files) FILES_LIST="${2:-}"; shift 2 ;;
--root) ROOT="${2:-}"; shift 2 ;;
--rules) RULES_DIR="${2:-}"; shift 2 ;;
--cap) CAP="${2:-}"; shift 2 ;;
--files) value "$1" $#; FILES_LIST="$2"; shift 2 ;;
--root) value "$1" $#; ROOT="$2"; shift 2 ;;
--rules) value "$1" $#; RULES_DIR="$2"; shift 2 ;;
--cap) value "$1" $#; CAP="$2"; shift 2 ;;
--plan) PLAN=1; shift ;;
--glob) OPT_GLOB="${2:-}"; shift 2 ;;
--test-re) OPT_TEST_RE="${2:-}"; shift 2 ;;
--glob) value "$1" $#; OPT_GLOB="$2"; shift 2 ;;
--test-re) value "$1" $#; OPT_TEST_RE="$2"; shift 2 ;;
-h|--help) usage ;;
--*) die "unknown option: $1" ;;
*) [[ -n "$BUNDLE" ]] && die "one bundle directory, got also: $1"; BUNDLE="$1"; shift ;;
Expand Down
19 changes: 19 additions & 0 deletions core/scripts/ldd-detect_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,25 @@ OUT=$(bash "$DETECT" "$REPO/does-not-exist" 2>&1); CODE=$?; ERR=""
expect_exit 2 && expect_has "not a directory" && ok
finish

# run_bounded <args...> — runs the script with exactly these arguments and
# stops it after five seconds, so a regression that loops fails, never hangs
run_bounded() {
local outf pid i; outf=$(mktemp)
( cd "$REPO" && exec bash "$DETECT" "$@" ) > "$outf" 2>&1 &
pid=$!
for (( i = 0; i < 50; i++ )); do kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
if kill -0 "$pid" 2>/dev/null; then kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; CODE=124; else wait "$pid"; CODE=$?; fi
OUT=$(cat "$outf"); ERR=""; rm -f "$outf"
}

ROW=""
for opt in --files --root --rules --cap --glob --test-re; do
begin "$opt without its value is a usage error (exit 2)"
run_bounded "$opt"
expect_exit 2 && expect_has "$opt needs a value" && ok
finish
done

# ========================= summary =========================
echo
echo "ldd-detect_test: $pass passed, $failed failed, $skipped skipped"
Expand Down
17 changes: 10 additions & 7 deletions core/scripts/ldd-scope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,18 @@ EXPLICIT=()
usage() { sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2; }
die() { echo "$SCRIPT_NAME: $*" >&2; exit 2; }

# value <option> <remaining argument count> — a value-taking option needs one
value() { (( $2 >= 2 )) || die "$1 needs a value"; }

while (( $# > 0 )); do
case "$1" in
--root) ROOT="${2:-}"; shift 2 ;;
--out) OUT="${2:-}"; shift 2 ;;
--max-lines) MAX_LINES="${2:-}"; shift 2 ;;
--glob) OPT_GLOB="${2:-}"; shift 2 ;;
--test-re) OPT_TEST_RE="${2:-}"; shift 2 ;;
--lang) OPT_LANG="${2:-}"; shift 2 ;;
--base) RUNG="base"; BASE="${2:-}"; shift 2 ;;
--root) value "$1" $#; ROOT="$2"; shift 2 ;;
--out) value "$1" $#; OUT="$2"; shift 2 ;;
--max-lines) value "$1" $#; MAX_LINES="$2"; shift 2 ;;
--glob) value "$1" $#; OPT_GLOB="$2"; shift 2 ;;
--test-re) value "$1" $#; OPT_TEST_RE="$2"; shift 2 ;;
--lang) value "$1" $#; OPT_LANG="$2"; shift 2 ;;
--base) value "$1" $#; RUNG="base"; BASE="$2"; shift 2 ;;
--all) RUNG="all"; shift ;;
-h|--help) usage ;;
--) shift; while (( $# > 0 )); do EXPLICIT+=("$1"); shift; done ;;
Expand Down
19 changes: 19 additions & 0 deletions core/scripts/ldd-scope_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,25 @@ expect_exit 0 && expect_flat custom && expect_has "1 files bundled" \
&& [[ "$(cat "$BUNDLE/scope-out/files.txt")" == "$MIXED_D" ]] && ok
finish

# run_bounded <args...> — runs the script with exactly these arguments and
# stops it after five seconds, so a regression that loops fails, never hangs
run_bounded() {
local outf pid i; outf=$(mktemp)
( cd "$REPO" && exec bash "$SCOPE_SH" "$@" ) > "$outf" 2>&1 &
pid=$!
for (( i = 0; i < 50; i++ )); do kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
if kill -0 "$pid" 2>/dev/null; then kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; CODE=124; else wait "$pid"; CODE=$?; fi
OUT=$(cat "$outf"); ERR=""; rm -f "$outf"
}

ROW=""
for opt in --root --out --max-lines --glob --test-re --lang --base; do
begin "$opt without its value is a usage error (exit 2)"
run_bounded "$opt"
expect_exit 2 && expect_has "$opt needs a value" && ok
finish
done

# ========================= summary =========================
echo
echo "ldd-scope_test: $pass passed, $failed failed, $skipped skipped"
Expand Down
7 changes: 7 additions & 0 deletions go-linter-driven-development/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
ran. The gap linter's `package-size` measures the same zones for every source
directory.

### Fixed

- **A value-taking option given last no longer hangs the review scripts.** When
`ldd-detect.sh` or `ldd-scope.sh` got an option such as `--root` or `--base` as
its last argument, the script looped forever. It now stops with "<option> needs
a value" and exit 2, the documented usage error.

## [2.16.0] - 2026-10-18

### Changed
Expand Down
15 changes: 9 additions & 6 deletions go-linter-driven-development/scripts/ldd-detect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ BUNDLE=""
usage() { sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2; }
die() { echo "$SCRIPT_NAME: $*" >&2; exit 2; }

# value <option> <remaining argument count> — a value-taking option needs one
value() { (( $2 >= 2 )) || die "$1 needs a value"; }

while (( $# > 0 )); do
case "$1" in
--files) FILES_LIST="${2:-}"; shift 2 ;;
--root) ROOT="${2:-}"; shift 2 ;;
--rules) RULES_DIR="${2:-}"; shift 2 ;;
--cap) CAP="${2:-}"; shift 2 ;;
--files) value "$1" $#; FILES_LIST="$2"; shift 2 ;;
--root) value "$1" $#; ROOT="$2"; shift 2 ;;
--rules) value "$1" $#; RULES_DIR="$2"; shift 2 ;;
--cap) value "$1" $#; CAP="$2"; shift 2 ;;
--plan) PLAN=1; shift ;;
--glob) OPT_GLOB="${2:-}"; shift 2 ;;
--test-re) OPT_TEST_RE="${2:-}"; shift 2 ;;
--glob) value "$1" $#; OPT_GLOB="$2"; shift 2 ;;
--test-re) value "$1" $#; OPT_TEST_RE="$2"; shift 2 ;;
-h|--help) usage ;;
--*) die "unknown option: $1" ;;
*) [[ -n "$BUNDLE" ]] && die "one bundle directory, got also: $1"; BUNDLE="$1"; shift ;;
Expand Down
19 changes: 19 additions & 0 deletions go-linter-driven-development/scripts/ldd-detect_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,25 @@ OUT=$(bash "$DETECT" "$REPO/does-not-exist" 2>&1); CODE=$?; ERR=""
expect_exit 2 && expect_has "not a directory" && ok
finish

# run_bounded <args...> — runs the script with exactly these arguments and
# stops it after five seconds, so a regression that loops fails, never hangs
run_bounded() {
local outf pid i; outf=$(mktemp)
( cd "$REPO" && exec bash "$DETECT" "$@" ) > "$outf" 2>&1 &
pid=$!
for (( i = 0; i < 50; i++ )); do kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
if kill -0 "$pid" 2>/dev/null; then kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; CODE=124; else wait "$pid"; CODE=$?; fi
OUT=$(cat "$outf"); ERR=""; rm -f "$outf"
}

ROW=""
for opt in --files --root --rules --cap --glob --test-re; do
begin "$opt without its value is a usage error (exit 2)"
run_bounded "$opt"
expect_exit 2 && expect_has "$opt needs a value" && ok
finish
done

# ========================= summary =========================
echo
echo "ldd-detect_test: $pass passed, $failed failed, $skipped skipped"
Expand Down
17 changes: 10 additions & 7 deletions go-linter-driven-development/scripts/ldd-scope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,18 @@ EXPLICIT=()
usage() { sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2; }
die() { echo "$SCRIPT_NAME: $*" >&2; exit 2; }

# value <option> <remaining argument count> — a value-taking option needs one
value() { (( $2 >= 2 )) || die "$1 needs a value"; }

while (( $# > 0 )); do
case "$1" in
--root) ROOT="${2:-}"; shift 2 ;;
--out) OUT="${2:-}"; shift 2 ;;
--max-lines) MAX_LINES="${2:-}"; shift 2 ;;
--glob) OPT_GLOB="${2:-}"; shift 2 ;;
--test-re) OPT_TEST_RE="${2:-}"; shift 2 ;;
--lang) OPT_LANG="${2:-}"; shift 2 ;;
--base) RUNG="base"; BASE="${2:-}"; shift 2 ;;
--root) value "$1" $#; ROOT="$2"; shift 2 ;;
--out) value "$1" $#; OUT="$2"; shift 2 ;;
--max-lines) value "$1" $#; MAX_LINES="$2"; shift 2 ;;
--glob) value "$1" $#; OPT_GLOB="$2"; shift 2 ;;
--test-re) value "$1" $#; OPT_TEST_RE="$2"; shift 2 ;;
--lang) value "$1" $#; OPT_LANG="$2"; shift 2 ;;
--base) value "$1" $#; RUNG="base"; BASE="$2"; shift 2 ;;
--all) RUNG="all"; shift ;;
-h|--help) usage ;;
--) shift; while (( $# > 0 )); do EXPLICIT+=("$1"); shift; done ;;
Expand Down
19 changes: 19 additions & 0 deletions go-linter-driven-development/scripts/ldd-scope_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,25 @@ expect_exit 0 && expect_flat custom && expect_has "1 files bundled" \
&& [[ "$(cat "$BUNDLE/scope-out/files.txt")" == "$MIXED_D" ]] && ok
finish

# run_bounded <args...> — runs the script with exactly these arguments and
# stops it after five seconds, so a regression that loops fails, never hangs
run_bounded() {
local outf pid i; outf=$(mktemp)
( cd "$REPO" && exec bash "$SCOPE_SH" "$@" ) > "$outf" 2>&1 &
pid=$!
for (( i = 0; i < 50; i++ )); do kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
if kill -0 "$pid" 2>/dev/null; then kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; CODE=124; else wait "$pid"; CODE=$?; fi
OUT=$(cat "$outf"); ERR=""; rm -f "$outf"
}

ROW=""
for opt in --root --out --max-lines --glob --test-re --lang --base; do
begin "$opt without its value is a usage error (exit 2)"
run_bounded "$opt"
expect_exit 2 && expect_has "$opt needs a value" && ok
finish
done

# ========================= summary =========================
echo
echo "ldd-scope_test: $pass passed, $failed failed, $skipped skipped"
Expand Down
7 changes: 7 additions & 0 deletions lang/generic/passthrough/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
code lines per file and 8 and 13 files per directory. The package-size
procedure runs the gap linter in place of a hand-written `find` command.

### Fixed

- **A value-taking option given last no longer hangs the review scripts.** When
`ldd-detect.sh` or `ldd-scope.sh` got an option such as `--root` or `--base` as
its last argument, the script looped forever. It now stops with "<option> needs
a value" and exit 2, the documented usage error.

## [0.6.0] - 2026-10-18

### Changed
Expand Down
7 changes: 7 additions & 0 deletions lang/go/passthrough/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
ran. The gap linter's `package-size` measures the same zones for every source
directory.

### Fixed

- **A value-taking option given last no longer hangs the review scripts.** When
`ldd-detect.sh` or `ldd-scope.sh` got an option such as `--root` or `--base` as
its last argument, the script looped forever. It now stops with "<option> needs
a value" and exit 2, the documented usage error.

## [2.16.0] - 2026-10-18

### Changed
Expand Down
7 changes: 7 additions & 0 deletions lang/python/passthrough/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
code lines per file and 8 and 13 files per directory. The package-size
procedure runs the gap linter in place of a hand-written `find` command.

### Fixed

- **A value-taking option given last no longer hangs the review scripts.** When
`ldd-detect.sh` or `ldd-scope.sh` got an option such as `--root` or `--base` as
its last argument, the script looped forever. It now stops with "<option> needs
a value" and exit 2, the documented usage error.

## [0.5.0] - 2026-10-18

### Changed
Expand Down
7 changes: 7 additions & 0 deletions lang/ts-react/passthrough/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
code lines per file and 8 and 13 files per directory. The package-size
procedure runs the gap linter in place of a hand-written `find` command.

### Fixed

- **A value-taking option given last no longer hangs the review scripts.** When
`ldd-detect.sh` or `ldd-scope.sh` got an option such as `--root` or `--base` as
its last argument, the script looped forever. It now stops with "<option> needs
a value" and exit 2, the documented usage error.

## [2.1.0] - 2026-10-18

### Changed
Expand Down
7 changes: 7 additions & 0 deletions linter-driven-development/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versio
code lines per file and 8 and 13 files per directory. The package-size
procedure runs the gap linter in place of a hand-written `find` command.

### Fixed

- **A value-taking option given last no longer hangs the review scripts.** When
`ldd-detect.sh` or `ldd-scope.sh` got an option such as `--root` or `--base` as
its last argument, the script looped forever. It now stops with "<option> needs
a value" and exit 2, the documented usage error.

## [0.6.0] - 2026-10-18

### Changed
Expand Down
15 changes: 9 additions & 6 deletions linter-driven-development/scripts/ldd-detect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,18 @@ BUNDLE=""
usage() { sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2; }
die() { echo "$SCRIPT_NAME: $*" >&2; exit 2; }

# value <option> <remaining argument count> — a value-taking option needs one
value() { (( $2 >= 2 )) || die "$1 needs a value"; }

while (( $# > 0 )); do
case "$1" in
--files) FILES_LIST="${2:-}"; shift 2 ;;
--root) ROOT="${2:-}"; shift 2 ;;
--rules) RULES_DIR="${2:-}"; shift 2 ;;
--cap) CAP="${2:-}"; shift 2 ;;
--files) value "$1" $#; FILES_LIST="$2"; shift 2 ;;
--root) value "$1" $#; ROOT="$2"; shift 2 ;;
--rules) value "$1" $#; RULES_DIR="$2"; shift 2 ;;
--cap) value "$1" $#; CAP="$2"; shift 2 ;;
--plan) PLAN=1; shift ;;
--glob) OPT_GLOB="${2:-}"; shift 2 ;;
--test-re) OPT_TEST_RE="${2:-}"; shift 2 ;;
--glob) value "$1" $#; OPT_GLOB="$2"; shift 2 ;;
--test-re) value "$1" $#; OPT_TEST_RE="$2"; shift 2 ;;
-h|--help) usage ;;
--*) die "unknown option: $1" ;;
*) [[ -n "$BUNDLE" ]] && die "one bundle directory, got also: $1"; BUNDLE="$1"; shift ;;
Expand Down
19 changes: 19 additions & 0 deletions linter-driven-development/scripts/ldd-detect_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,25 @@ OUT=$(bash "$DETECT" "$REPO/does-not-exist" 2>&1); CODE=$?; ERR=""
expect_exit 2 && expect_has "not a directory" && ok
finish

# run_bounded <args...> — runs the script with exactly these arguments and
# stops it after five seconds, so a regression that loops fails, never hangs
run_bounded() {
local outf pid i; outf=$(mktemp)
( cd "$REPO" && exec bash "$DETECT" "$@" ) > "$outf" 2>&1 &
pid=$!
for (( i = 0; i < 50; i++ )); do kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
if kill -0 "$pid" 2>/dev/null; then kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; CODE=124; else wait "$pid"; CODE=$?; fi
OUT=$(cat "$outf"); ERR=""; rm -f "$outf"
}

ROW=""
for opt in --files --root --rules --cap --glob --test-re; do
begin "$opt without its value is a usage error (exit 2)"
run_bounded "$opt"
expect_exit 2 && expect_has "$opt needs a value" && ok
finish
done

# ========================= summary =========================
echo
echo "ldd-detect_test: $pass passed, $failed failed, $skipped skipped"
Expand Down
17 changes: 10 additions & 7 deletions linter-driven-development/scripts/ldd-scope.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,18 @@ EXPLICIT=()
usage() { sed -n '2,/^$/p' "$0" | sed 's/^# \{0,1\}//' >&2; exit 2; }
die() { echo "$SCRIPT_NAME: $*" >&2; exit 2; }

# value <option> <remaining argument count> — a value-taking option needs one
value() { (( $2 >= 2 )) || die "$1 needs a value"; }

while (( $# > 0 )); do
case "$1" in
--root) ROOT="${2:-}"; shift 2 ;;
--out) OUT="${2:-}"; shift 2 ;;
--max-lines) MAX_LINES="${2:-}"; shift 2 ;;
--glob) OPT_GLOB="${2:-}"; shift 2 ;;
--test-re) OPT_TEST_RE="${2:-}"; shift 2 ;;
--lang) OPT_LANG="${2:-}"; shift 2 ;;
--base) RUNG="base"; BASE="${2:-}"; shift 2 ;;
--root) value "$1" $#; ROOT="$2"; shift 2 ;;
--out) value "$1" $#; OUT="$2"; shift 2 ;;
--max-lines) value "$1" $#; MAX_LINES="$2"; shift 2 ;;
--glob) value "$1" $#; OPT_GLOB="$2"; shift 2 ;;
--test-re) value "$1" $#; OPT_TEST_RE="$2"; shift 2 ;;
--lang) value "$1" $#; OPT_LANG="$2"; shift 2 ;;
--base) value "$1" $#; RUNG="base"; BASE="$2"; shift 2 ;;
--all) RUNG="all"; shift ;;
-h|--help) usage ;;
--) shift; while (( $# > 0 )); do EXPLICIT+=("$1"); shift; done ;;
Expand Down
19 changes: 19 additions & 0 deletions linter-driven-development/scripts/ldd-scope_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,25 @@ expect_exit 0 && expect_flat custom && expect_has "1 files bundled" \
&& [[ "$(cat "$BUNDLE/scope-out/files.txt")" == "$MIXED_D" ]] && ok
finish

# run_bounded <args...> — runs the script with exactly these arguments and
# stops it after five seconds, so a regression that loops fails, never hangs
run_bounded() {
local outf pid i; outf=$(mktemp)
( cd "$REPO" && exec bash "$SCOPE_SH" "$@" ) > "$outf" 2>&1 &
pid=$!
for (( i = 0; i < 50; i++ )); do kill -0 "$pid" 2>/dev/null || break; sleep 0.1; done
if kill -0 "$pid" 2>/dev/null; then kill "$pid" 2>/dev/null; wait "$pid" 2>/dev/null; CODE=124; else wait "$pid"; CODE=$?; fi
OUT=$(cat "$outf"); ERR=""; rm -f "$outf"
}

ROW=""
for opt in --root --out --max-lines --glob --test-re --lang --base; do
begin "$opt without its value is a usage error (exit 2)"
run_bounded "$opt"
expect_exit 2 && expect_has "$opt needs a value" && ok
finish
done

# ========================= summary =========================
echo
echo "ldd-scope_test: $pass passed, $failed failed, $skipped skipped"
Expand Down
Loading
Loading