Files
computer-playbook/scripts/lint/php.sh
T
kevinveenbirkenbachandClaude Opus 5 82218087c1 feat(lint): check the syntax of the PHP and Ruby the roles ship
Twenty-three PHP and twenty Ruby files reached the applications unchecked,
which is where the provisioning scripts live. php -l and ruby -c cover what
is reachable here; PHPStan and RuboCop would need the target project's
classes, since these scripts run inside Moodle, Snipe-IT or GitLab.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-12 15:46:26 +02:00

20 lines
559 B
Bash
Executable File

#!/usr/bin/env bash
# shellcheck shell=bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd -- "${SCRIPT_DIR}/../.." && pwd)"
cd "${REPO_ROOT}"
mapfile -t php_files < <(find . -type f -name '*.php' 2>/dev/null | sed 's|^\./||' | sort)
if [[ "${#php_files[@]}" -eq 0 ]]; then
printf 'No PHP files found.\n'
exit 0
fi
printf 'Checking %d PHP file(s) with php -l.\n' "${#php_files[@]}"
printf '%s\0' "${php_files[@]}" | xargs -0 -n1 php -l >/dev/null
printf 'php -l OK (%d file(s))\n' "${#php_files[@]}"