mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 02:54:26 +00:00
Four parse checks join the `lint-*` family, each using the language's own parser rather than a reimplementation: `php -l`, `ruby -c`, `sqlfluff parse`, and stylelint with an empty rule set (it raises CssSyntaxError whatever the rules say, so the check stays syntax-only and grows no style opinion). Three unit runners join `test-unit`: node:test, PHPUnit, minitest -- the first and third ship with their runtime, so only PHPUnit adds a dependency. Provisioning is best effort and the lint script decides whether it can run. A machine without PHP must not fail the gate, but it must not look like success either: the skip names how many files went unchecked. The first version of these scripts read `git ls-files`, which inside the compose container returns nothing (git refuses the bind-mounted repo as "dubious ownership") and reported "No SQL files found." over 52 files -- green, and a lie. They use `find` now, as the surrounding lint scripts already did. sqlfluff needed two corrections before it parsed anything real. `%(name)s` is a psycopg parameter marker, not SQL, so the placeholder templater is configured rather than the files exempted; and the dialect follows each role's declared engine (`meta/services.yml`), which is postgres for six roles and mysql for svc-db-mariadb and pixelfed. Recipes stay in scripts, not in the Makefile: the targets delegate, matching every other target in the file. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
40 lines
971 B
Bash
Executable File
40 lines
971 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# shellcheck shell=bash
|
|
#
|
|
# File discovery uses find, not git ls-files: inside the compose container git
|
|
# refuses the bind-mounted repo with "detected dubious ownership", which makes
|
|
# git ls-files print nothing and turns this lint into a silent no-op.
|
|
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
|
|
|
|
cd "${REPO_ROOT}"
|
|
|
|
mapfile -t ruby_files < <(
|
|
find . -type f -name '*.rb' \
|
|
-not -path './node_modules/*' \
|
|
-not -path './.git/*' |
|
|
sed 's|^\./||' | sort
|
|
)
|
|
if [[ "${#ruby_files[@]}" -eq 0 ]]; then
|
|
printf 'No Ruby files found.\n'
|
|
exit 0
|
|
fi
|
|
|
|
if ! command -v ruby >/dev/null 2>&1; then
|
|
printf 'SKIP: ruby is not installed; %d file(s) left unchecked.\n' "${#ruby_files[@]}"
|
|
exit 0
|
|
fi
|
|
|
|
failed=0
|
|
for file in "${ruby_files[@]}"; do
|
|
if ! ruby -c "${file}" >/dev/null; then
|
|
printf '%s: does not parse\n' "${file}" >&2
|
|
failed=1
|
|
fi
|
|
done
|
|
|
|
exit "${failed}"
|